Answered
How do I have the answer of a function into matrix?
Use the *|bsxfun|* function in your function: c = @(a,b) bsxfun(@plus, a(:), b(:)'); Then call it as: a= -1:0.2:1...

9 years ago | 0

Answered
Extracting coordinate values from a 3-D matrix
I would do something like this: lat = 1:7; % Create Test Data lon = 1:9; ...

9 years ago | 0

Answered
why am i facing this error in plotting ?
Your code runs for me without error in *|R2017b|*. One possibility is that since *|‘x’|* is a _row_ vector and *|‘u’|* is a...

9 years ago | 1

Answered
Plot multiple variables in different colors with scatter3
Try this: x1 = randi(9, 5, 1); y1 = randi(9, 5, 1); z1 = randi(9, 5, 1); x2 = randi(9, 5, 1); y2 = randi(9...

9 years ago | 1

| accepted

Answered
Undefined function or variable 'x'. Where the error are?
Here: n22 = -m-beta*((lambda1(j)-h2*n11)-(lambda2(j)-h2*n12))-alpha*(0.5*(x1(j)+x1(j-1)))*(u1(j))*((lambda1(j)-h2*n11)-(la...

9 years ago | 0

| accepted

Answered
I have a cell array of size 136 by 1 and i want it to convert it to array of type double. How can i do this?
What is in your cell array? If it is only numeric, the *|cell2mat|* function will work. If it also has non-numeric element...

9 years ago | 1

| accepted

Answered
How to draw plot with just one variable
I am not certain what you want to do. Try this: y = randi(9, 39, 1); myothervariable = 1:50; ynew = interp1...

9 years ago | 0

| accepted

Answered
Plot a for loop but it doesn't show all the curves on my graph
Try this: k=3; stimulus = 1:100; hold on; for a=1:10 modelS=k*(stimulus.^a); plot(stimulus,modelS, ...

9 years ago | 0

Answered
Why does it say Matrix dimensions must agree? How can I fix this?
Your *|‘t’|* calculation produces a scalar. Use these and it works: r = linspace(0,900); t = linspace(0,25); *_...

9 years ago | 0

| accepted

Answered
How to calculate time elapsed (time in GMT format)
One approach: v = {'2017-12-13-T16:00:23.488+08:00' '2017-12-13-T16:02:24.982+08:00'}; T = datenum(v, 'yyyy-mm-...

9 years ago | 1

| accepted

Answered
How to get a sin function in simulink
Try this: <https://www.mathworks.com/help/simulink/slref/sine.html *Sine, Cosine*> (link)

9 years ago | 0

Answered
Cos function in simulink
Take the derivative of the sine? Otherwise: <https://www.mathworks.com/help/simulink/slref/sine.html *Sine, Cosine*> (link)...

9 years ago | 2

Answered
Finding the maximum y value for one graph
I cannot run your code because I do not have your ODE function. However when I create an ODE function to work with it, you code...

9 years ago | 1

| accepted

Answered
Problem with Legend command.
The problem is the first plot call. Change it to: fplot(yy1,[-5 5],'m'); and everything else works. *_EDIT_ —...

9 years ago | 0

Answered
pattern of color range of different shades of a particular colors RGB values?
In the colors you quoted, the third channel (blue) has the greatest value. Perhaps choosing vectors with the maximum in the thi...

9 years ago | 0

Answered
i am getting an error. on putting values in a function. Here Y is average of all values of (dx)/(dt)
First, there is no *|0|* subscript in MATLAB, since MATLAB subscripts are integers greater than *|0|*: F=@(t,x)[x(2)-(x(1)...

9 years ago | 0

Answered
How do you store solutions to a loop in an array?
In MATLAB, subscripts can only be _integers_ greater than *|0|*, or logical variables. I do not follow what you are doing. ...

9 years ago | 0

Answered
Solve a second order differential equation system
Try this: syms za(t) zf(t) zd(t) T Y Eq1 = diff(zf,2) == 9.81-(7.54)*diff(zf)+(7.54)*diff(zd)-(3942.4)*zf+(3942.4)*zd ...

9 years ago | 0

Answered
maximum and minimum of a differential equation
I was intending to direct you to: lookfor maximum except it did not pull up the *|max|* function, so I mention it here....

9 years ago | 0

Answered
Plotting text on the x-axis for residual analysis
I don’t entirely understand what _‘can't seem to make it work’_ means, so this is a _guess_. You probably need to use the *...

9 years ago | 0

Answered
Adding Random phase causes fft anomalies?
The random phase will shift your sine curve randomly in *_time_*, essentially destroying the periodicity. You can see this easi...

9 years ago | 0

| accepted

Answered
About summing of anonymous function
*_Do you know how to deal with it?_* Create another anonymous function that calls the other functions. If you have one ...

9 years ago | 1

| accepted

Answered
Convert Complex data to Real
*_... is there any way to convert it to a real signal with twice the amount of points @20MSps_* The only way I can imagine t...

9 years ago | 0

Answered
fsolve multi variables help
I can’t figure out what you want to do. The optimisation routines want the objective function argument to be a vector. The...

9 years ago | 0

| accepted

Answered
How can I plot slope including maximum peaks?
If you have the Signal Processing Toolbox, use the *|findpeaks|* function to define the peaks and their locations. You can then...

9 years ago | 0

| accepted

Answered
analyse aircraft vibration data
I’d plot it in the time domain and frequency domain. (See the documentation on the <https://www.mathworks.com/help/releases/R20...

9 years ago | 1

Answered
How can i use a defined variable in equation for fitting ?
One option is to use an anonymous function: b = 3; f = @(a) a.*x + b; To do a simple linear fit, you need only cor...

9 years ago | 0

Answered
fsolve for 2 equation with 2 variables
What is the initial point you chose? Your function returns finite values for random non-zero arguments. It returns *|[NaN NaN]...

9 years ago | 0

| accepted

Answered
Normalizing columns: Does my function do the same as "normc"?
No, but this one does: m = [1 2; 3 4]; normc_fcn = @(m) sqrt(m.^2 ./ sum(m.^2)); Q1 = normc(m) Q2 = normc...

9 years ago | 1

Answered
Creating a 3D surface plot from a matrix
That would only be possible if your data are gridded (so the *|x|* and *|y|* data are in regular patterns). Probably the ea...

9 years ago | 1

| accepted

Load more