Answered

How to plot a, as varibale stored chart?

MATLAB graphics objects cannot be saved as variable by using their handles. Once the figure closes, the handle becomes invalid. ...

How to plot a, as varibale stored chart?

MATLAB graphics objects cannot be saved as variable by using their handles. Once the figure closes, the handle becomes invalid. ...

alrededor de 4 horas ago | 0

Answered

How to replace (in a vector ) every value by the average of the previous n samples? (To smooth a signal)

Try movmean() movmean(SE_rest, [100 0])

How to replace (in a vector ) every value by the average of the previous n samples? (To smooth a signal)

Try movmean() movmean(SE_rest, [100 0])

alrededor de 4 horas ago | 1

Answered

converting cell to struct with fields

Something like this S.DeliArg = [DeliArg{:}]; S.AlgTry = [AlgTry{:}];

converting cell to struct with fields

Something like this S.DeliArg = [DeliArg{:}]; S.AlgTry = [AlgTry{:}];

alrededor de 4 horas ago | 0

| accepted

Answered

Index exceeds the number of array elements?

It seems that you are trying to find a derivative of rho_s w.r.t. T, you can use gradient() function p = 10; a = 1000; b = 0....

Index exceeds the number of array elements?

It seems that you are trying to find a derivative of rho_s w.r.t. T, you can use gradient() function p = 10; a = 1000; b = 0....

alrededor de 4 horas ago | 0

| accepted

Answered

How to plot multiple functions with a for loop

H = [0.05 0.1 0.2]; figure; hold on for i=1:numel(H) y0 = 0; t0 = 0; tf = 1; h = H(i); f = @(t,...

How to plot multiple functions with a for loop

H = [0.05 0.1 0.2]; figure; hold on for i=1:numel(H) y0 = 0; t0 = 0; tf = 1; h = H(i); f = @(t,...

1 día ago | 0

| accepted

Answered

The ecdf(x) always starts from the origin of the axis

Try this [f, x] = ecdf(fluc_freq); mask = x > 0; plot(x(mask), f(mask))

The ecdf(x) always starts from the origin of the axis

Try this [f, x] = ecdf(fluc_freq); mask = x > 0; plot(x(mask), f(mask))

1 día ago | 1

| accepted

Answered

How do I show only two colors in my Legend?

You can use the handle returned by plot() with legend() to only show specific legends. For example hold on; p(1) = plot(rand(1...

How do I show only two colors in my Legend?

You can use the handle returned by plot() with legend() to only show specific legends. For example hold on; p(1) = plot(rand(1...

1 día ago | 0

Answered

function or functions of a single variable

You need to pass a function handle fplot(@(x) -exp(-x)+x.^2+2*x+2, [0 1])

function or functions of a single variable

You need to pass a function handle fplot(@(x) -exp(-x)+x.^2+2*x+2, [0 1])

2 días ago | 1

Answered

Compare every element in a vector and find the minimum distance to a constant value.

Something like this x = [2, 8, 15, 11, 2]; % modified so that it have two minumum distances a = 12; D = abs(x - x.' - a); ...

Compare every element in a vector and find the minimum distance to a constant value.

Something like this x = [2, 8, 15, 11, 2]; % modified so that it have two minumum distances a = 12; D = abs(x - x.' - a); ...

2 días ago | 0

Answered

convert alphabet to coresponding number by using ASCII

Like this char2num = @(c) char(c)-96; Example >> char2num('a') ans = 1 >> char2num('b') ans = 2 >> char2num('...

convert alphabet to coresponding number by using ASCII

Like this char2num = @(c) char(c)-96; Example >> char2num('a') ans = 1 >> char2num('b') ans = 2 >> char2num('...

2 días ago | 0

| accepted

Answered

Replace certain elements of vector with the values from another vector

There is no need for a for-loop S_1(m) = S_2(m);

Replace certain elements of vector with the values from another vector

There is no need for a for-loop S_1(m) = S_2(m);

2 días ago | 0

| accepted

Answered

App Designer Issues and Suggestions

All the improvements suggested in your question are quite useful. I am just adding this answer so that the question does not aut...

App Designer Issues and Suggestions

All the improvements suggested in your question are quite useful. I am just adding this answer so that the question does not aut...

2 días ago | 1

Answered

Calculating volume of a tetramesh

As explained in Walter's answer here: https://www.mathworks.com/matlabcentral/answers/22394-how-to-get-the-volume-information-ou...

Calculating volume of a tetramesh

As explained in Walter's answer here: https://www.mathworks.com/matlabcentral/answers/22394-how-to-get-the-volume-information-ou...

2 días ago | 0

Answered

find x intercepts numerically

Try this f = @(x) find(diff(sign(x))); Example >> x = [1 2 -1 -2 -1 2 3 1 -2 -3 -2 1]; >> f(x) ans = 2 5 8 ...

find x intercepts numerically

Try this f = @(x) find(diff(sign(x))); Example >> x = [1 2 -1 -2 -1 2 3 1 -2 -3 -2 1]; >> f(x) ans = 2 5 8 ...

2 días ago | 0

| accepted

Answered

Make multiple plots of multiple files in for loop

It should be data = importdata(files(i).name);

Make multiple plots of multiple files in for loop

It should be data = importdata(files(i).name);

2 días ago | 0

| accepted

Answered

Is it possible to visualize all data in a multiple scatterplot?

Maybe use scatter3() and visualize by using a z-offset. Not sure if it helps in your case h1 = scatter3(table{:,variable},table...

Is it possible to visualize all data in a multiple scatterplot?

Maybe use scatter3() and visualize by using a z-offset. Not sure if it helps in your case h1 = scatter3(table{:,variable},table...

2 días ago | 0

Answered

specify axis limit to be nonneagtive

You can set the upper limit to Inf to let MATLAB automatically that axis([0 inf 0 inf 0 inf]) or xlim([0 inf]) ylim([0 inf])...

specify axis limit to be nonneagtive

You can set the upper limit to Inf to let MATLAB automatically that axis([0 inf 0 inf 0 inf]) or xlim([0 inf]) ylim([0 inf])...

2 días ago | 0

| accepted

Answered

how to know the array of the function that i plot

See this example to convert to strings to function handles and multiply them y1 = 'sin(x)'; y2 = 'cos(x)'; y1f = str2func([...

how to know the array of the function that i plot

See this example to convert to strings to function handles and multiply them y1 = 'sin(x)'; y2 = 'cos(x)'; y1f = str2func([...

2 días ago | 0

| accepted

Answered

Using fsolve with type double

To use a symbolic equation with fsolve(), first convert it to a floating-point function handle. See matlabFunction(): https://ww...

Using fsolve with type double

To use a symbolic equation with fsolve(), first convert it to a floating-point function handle. See matlabFunction(): https://ww...

2 días ago | 0

Answered

Creating a new matrix of size A with columns n:n+56 and zeros

Using variable names like A2, A3, A4, ... is never a good idea: https://www.mathworks.com/matlabcentral/answers/304528-tutorial-...

Creating a new matrix of size A with columns n:n+56 and zeros

Using variable names like A2, A3, A4, ... is never a good idea: https://www.mathworks.com/matlabcentral/answers/304528-tutorial-...

2 días ago | 0

Answered

I need to solve a cauchy problem with the Euler Method.

Following shows how to find true solution using symbolic toolbox and plot both of them on same graph % Eulerian Method % Setup...

I need to solve a cauchy problem with the Euler Method.

Following shows how to find true solution using symbolic toolbox and plot both of them on same graph % Eulerian Method % Setup...

2 días ago | 0

| accepted

Answered

How can I save a vector in a for loop to a pre-allocated cell if my first value of the loop (i) is not 1?

Write the for-loop like this x = 20:5:60; for i = 1:numel(x) % instead of i write x(i) sol{i} = results; end

How can I save a vector in a for loop to a pre-allocated cell if my first value of the loop (i) is not 1?

Write the for-loop like this x = 20:5:60; for i = 1:numel(x) % instead of i write x(i) sol{i} = results; end

2 días ago | 0

Answered

How to compute monthly average and standard deviation with for loop

If you have Statistics and Machine Learning Toolbox, then you can use grpstat(). For example format long g folder = 'BCC_CSM.x...

How to compute monthly average and standard deviation with for loop

If you have Statistics and Machine Learning Toolbox, then you can use grpstat(). For example format long g folder = 'BCC_CSM.x...

2 días ago | 0

Answered

Pick a number from an array with a certain probability

If you can use pre-defined functions and you have Statistics and Machine Learning Toolbox, then you can use randsample(): https:...

Pick a number from an array with a certain probability

If you can use pre-defined functions and you have Statistics and Machine Learning Toolbox, then you can use randsample(): https:...

2 días ago | 0

| accepted

Answered

How to create a blue color gradient

An alternate approach using indexed image cols = 2160; rows = 3840; left_color = [1 1 1]; % white right_color = [0 0.25 0.5]...

How to create a blue color gradient

An alternate approach using indexed image cols = 2160; rows = 3840; left_color = [1 1 1]; % white right_color = [0 0.25 0.5]...

2 días ago | 1

Answered

Answer Output in Column Array

It depends on how the answer is generated. Suppose the following cases. >> x = {1, 2, 3, 4}; >> x{:} ans = 1 ans = ...

Answer Output in Column Array

It depends on how the answer is generated. Suppose the following cases. >> x = {1, 2, 3, 4}; >> x{:} ans = 1 ans = ...

2 días ago | 0

Answered

Fractional Order transfer function

See this FEX package: https://www.mathworks.com/matlabcentral/fileexchange/66323-fomcon-toolbox-for-matlab. It provides blocks f...

Fractional Order transfer function

See this FEX package: https://www.mathworks.com/matlabcentral/fileexchange/66323-fomcon-toolbox-for-matlab. It provides blocks f...

2 días ago | 0

Answered

Speeding up nested for loops that create a matrix within a matrix

Try something like the following code. It might not be faster, however, it made the code concise. Hopefully, you have already in...

Speeding up nested for loops that create a matrix within a matrix

Try something like the following code. It might not be faster, however, it made the code concise. Hopefully, you have already in...

2 días ago | 0

| accepted

Answered

How to calculate log(a/b) for each two rows at each column ?

a = ... [2 3 6 5 7 4 5 4 7 8 9 6 4 5 8 9 8 5]; b = log(a(2:end, :)./a(1:end-1,:)); Result >> b b = 0.9...

How to calculate log(a/b) for each two rows at each column ?

a = ... [2 3 6 5 7 4 5 4 7 8 9 6 4 5 8 9 8 5]; b = log(a(2:end, :)./a(1:end-1,:)); Result >> b b = 0.9...

2 días ago | 1

| accepted

Answered

How can I execute a single line in the editor/debugger?

On mac the default shortcut is: Shift + fn + F7

How can I execute a single line in the editor/debugger?

On mac the default shortcut is: Shift + fn + F7

2 días ago | 0

| accepted