Communication through MATLAB is always better than arguing.

Answered

How can I create a step response with the following unit step function as input?

F = @(t) (t < .98) * 3 +(t > .98) * 6 fplot(F,[0,2])

How can I create a step response with the following unit step function as input?

F = @(t) (t < .98) * 3 +(t > .98) * 6 fplot(F,[0,2])

36 minutes ago | 0

Answered

How to plot x(n) for many values of n?

Shorter code eliminating loop: Alpha = 2 x0 = 100; % Initial conditions n = 1:30; x = Alpha.^n*x0; plot(n,x) Note: You w...

How to plot x(n) for many values of n?

Shorter code eliminating loop: Alpha = 2 x0 = 100; % Initial conditions n = 1:30; x = Alpha.^n*x0; plot(n,x) Note: You w...

2 hours ago | 0

| accepted

Answered

slicing matrix in efficient way

Matrix = reshape(1:120,10,[]); x = Matrix(:,1:3:end) y = Matrix(:,2:3:end) z = Matrix(:,3:3:end)

slicing matrix in efficient way

Matrix = reshape(1:120,10,[]); x = Matrix(:,1:3:end) y = Matrix(:,2:3:end) z = Matrix(:,3:3:end)

22 hours ago | 1

Answered

Can anybody help on this FOR loops

[Ln, Mn, Gamma_n, Mn_star, fn_st] = zeros(N,1); for n = 1:N Ln(n)=V(1:N,n)'*M*l; Mn(n)=V(1:N,n)'*M*V(1:N,n); Gamma_...

Can anybody help on this FOR loops

[Ln, Mn, Gamma_n, Mn_star, fn_st] = zeros(N,1); for n = 1:N Ln(n)=V(1:N,n)'*M*l; Mn(n)=V(1:N,n)'*M*V(1:N,n); Gamma_...

23 hours ago | 0

Answered

Count number of occurrences in each second.

x = [1.1, 1.2, 1.5, 1.9, 2, 2.5, 2.9]; u = unique(fix(x)); Counts = arrayfun(@(y) nnz(x>=y & x<(y+1)), u) %or Counts = sum(...

Count number of occurrences in each second.

x = [1.1, 1.2, 1.5, 1.9, 2, 2.5, 2.9]; u = unique(fix(x)); Counts = arrayfun(@(y) nnz(x>=y & x<(y+1)), u) %or Counts = sum(...

23 hours ago | 0

| accepted

Answered

Assign name to matrices in a loop

https://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dynamically-eval - why not to ...

Assign name to matrices in a loop

https://www.mathworks.com/matlabcentral/answers/304528-tutorial-why-variables-should-not-be-named-dynamically-eval - why not to ...

23 hours ago | 1

| accepted

Answered

How to plot with different calibrations?

<https://www.mathworks.com/help/matlab/math/parameterizing-functions.html>

How to plot with different calibrations?

<https://www.mathworks.com/help/matlab/math/parameterizing-functions.html>

1 day ago | 0

Answered

extract data from a loop

No loops needed: mu0=4*pi*10^-7; R=0.9; N=17; I=12.5; z=-1.5:0.01:1.5; B1=((mu0*N*I*R^2)/2).*(1./(R^2+(z+(R/2)).^2).^(3/2)...

extract data from a loop

No loops needed: mu0=4*pi*10^-7; R=0.9; N=17; I=12.5; z=-1.5:0.01:1.5; B1=((mu0*N*I*R^2)/2).*(1./(R^2+(z+(R/2)).^2).^(3/2)...

1 day ago | 0

Answered

I want to sum specific element from a row vector

Wanted = sum(reshape(pre(:,1),365,[]))

I want to sum specific element from a row vector

Wanted = sum(reshape(pre(:,1),365,[]))

1 day ago | 1

| accepted

Answered

How do you plot this polynomial.

<https://www.mathworks.com/matlabcentral/answers/23982-plotting-a-polynomial-function>

How do you plot this polynomial.

<https://www.mathworks.com/matlabcentral/answers/23982-plotting-a-polynomial-function>

1 day ago | 0

| accepted

Answered

reduce vector each loop

The end indexing inside the loop would be total number of elements in x minus iterator.

reduce vector each loop

The end indexing inside the loop would be total number of elements in x minus iterator.

1 day ago | 0

Answered

Help me out in this equation, how to write a code for it, Where the value of (a) should be the Input in the code.

doc input

Help me out in this equation, how to write a code for it, Where the value of (a) should be the Input in the code.

doc input

2 days ago | 0

Answered

Probe data from a field in a structure

Counts = nnz(ismember(STRUCt.frames,[1,1092]))

Probe data from a field in a structure

Counts = nnz(ismember(STRUCt.frames,[1,1092]))

2 days ago | 0

Answered

Function Requests and receives from the user the dimensions of the sampled matrix until a proper value is obtained

infinite loop if true , break else input again and break Note: (m condition goes here) && (n condition goes here), You have m...

Function Requests and receives from the user the dimensions of the sampled matrix until a proper value is obtained

infinite loop if true , break else input again and break Note: (m condition goes here) && (n condition goes here), You have m...

2 days ago | 0

Answered

For loop for function values

stats_BW_R = cell(1,5); for k = 1:5 R = imcrop(BW2_BW, rows{k}); % rows = [row_1,...row_5] stats_BW_R{k} = region...

For loop for function values

stats_BW_R = cell(1,5); for k = 1:5 R = imcrop(BW2_BW, rows{k}); % rows = [row_1,...row_5] stats_BW_R{k} = region...

2 days ago | 1

| accepted

Answered

how can i get 498 matrices???

n=500; h=1/(n+1); x=linspace(0,1,n+2); t=0:1e-5:1; phi = cell(size(t)); for ii=1:498 phi(ii)={BSSpline((t-(ii).*h)/h...

how can i get 498 matrices???

n=500; h=1/(n+1); x=linspace(0,1,n+2); t=0:1e-5:1; phi = cell(size(t)); for ii=1:498 phi(ii)={BSSpline((t-(ii).*h)/h...

2 days ago | 0

Answered

how do I plot specific columns from a cell array?

layerpicks=[1,11,21,31,41]; plot(time/60,cell2mat(IntTemperatures(:,layerpicks)),'.')

how do I plot specific columns from a cell array?

layerpicks=[1,11,21,31,41]; plot(time/60,cell2mat(IntTemperatures(:,layerpicks)),'.')

2 days ago | 0

Answered

Finding row entries that are not equal?

matrix(:,1) ~= matrix(:,2)

Finding row entries that are not equal?

matrix(:,1) ~= matrix(:,2)

2 days ago | 0

| accepted

Answered

Hello, I'm new to matlab. Can u help me to solve this question?

https://www.mathworks.com/learn/tutorials/matlab-onramp.html?s_cid=learn_ONRAMP_BAN - first step

Hello, I'm new to matlab. Can u help me to solve this question?

https://www.mathworks.com/learn/tutorials/matlab-onramp.html?s_cid=learn_ONRAMP_BAN - first step

2 days ago | 0

Answered

Solve symbolic equation with derivatives

dsolve(...) is the one to be used for odes.

Solve symbolic equation with derivatives

dsolve(...) is the one to be used for odes.

2 days ago | 0

Answered

Pattern search and string indexing

A = @(x){[x(2), x(4), x(1)],[x(3),x(5)],[x(2),x(1)]} B = {2465,2514,147,236,58} C = A(B)

Pattern search and string indexing

A = @(x){[x(2), x(4), x(1)],[x(3),x(5)],[x(2),x(1)]} B = {2465,2514,147,236,58} C = A(B)

2 days ago | 0

Answered

error in solving system of nonlinear equations

sol = solve([eq1, eq2, eq3, eq4],[x,y,z,T]); %proper way to use solve

error in solving system of nonlinear equations

sol = solve([eq1, eq2, eq3, eq4],[x,y,z,T]); %proper way to use solve

2 days ago | 0

Answered

What are the commands for...

https://www.mathworks.com/help/symbolic/colspace.html - see bottom of the page for similar functionality functions.

What are the commands for...

https://www.mathworks.com/help/symbolic/colspace.html - see bottom of the page for similar functionality functions.

2 days ago | 0

Answered

Plot Multiple Functions in a single call to fplot

Long story short , it's not possible to use fplot(...) in a single call.

Plot Multiple Functions in a single call to fplot

Long story short , it's not possible to use fplot(...) in a single call.

2 days ago | 2

Answered

If statement doesn't return base case

result = (inp < 25) + abs((log(100./inp)/log(4))) .* (inp>=25)

If statement doesn't return base case

result = (inp < 25) + abs((log(100./inp)/log(4))) .* (inp>=25)

2 days ago | 0