Answered

ODE45 for a System of Second-Order Equations

I didn’t see this earlier. I’m sure you will find the odeToVectorField and matlabFunction functions helpful.

ODE45 for a System of Second-Order Equations

I didn’t see this earlier. I’m sure you will find the odeToVectorField and matlabFunction functions helpful.

9 days ago | 0

Answered

simple matrix process for some values

Use ‘logical indexing’: M = randi(10,6) Mnew = M+(M<5)*10 producing (in this random instance): M = 8 6 5 ...

simple matrix process for some values

Use ‘logical indexing’: M = randi(10,6) Mnew = M+(M<5)*10 producing (in this random instance): M = 8 6 5 ...

9 days ago | 0

| accepted

Answered

Graph Legend not picking up third plot marker

It is likely not possible to determine what the problem is without the actual data and relevant code. In their absence, try t...

Graph Legend not picking up third plot marker

It is likely not possible to determine what the problem is without the actual data and relevant code. In their absence, try t...

9 days ago | 0

Answered

how to colour an area on graph

If I understand correctly what you want to do, the easiest option is likely the fill function.

how to colour an area on graph

If I understand correctly what you want to do, the easiest option is likely the fill function.

9 days ago | 0

Answered

Saving Data for for loop into a vector

The loop is likely not necessary. Try this: idx = find(THRUST>=0.43, 1, 'first'); Time = TIME(idx); to get the closest in...

Saving Data for for loop into a vector

The loop is likely not necessary. Try this: idx = find(THRUST>=0.43, 1, 'first'); Time = TIME(idx); to get the closest in...

9 days ago | 0

Answered

In a array, finding x for the first instance of y.

Depending on what you want: idx = find(y>=1, 1, 'first'); time = x(idx); or: idx = find(y>=1, 1, 'first'); time = interp1...

In a array, finding x for the first instance of y.

Depending on what you want: idx = find(y>=1, 1, 'first'); time = x(idx); or: idx = find(y>=1, 1, 'first'); time = interp1...

9 days ago | 0

| accepted

Answered

Plotting within a nested for loop

There appears to be only one for loop, not nested loops. I would do: x = zeros(1:numel(TempV2)); y = zeros(1:numel(TempV2)...

Plotting within a nested for loop

There appears to be only one for loop, not nested loops. I would do: x = zeros(1:numel(TempV2)); y = zeros(1:numel(TempV2)...

9 days ago | 1

Answered

"Array indicies must be positive integers" error

Note that 0 is not a positive integer. Positive integers are integers greater than 0. That is likely also going to be a prob...

"Array indicies must be positive integers" error

Note that 0 is not a positive integer. Positive integers are integers greater than 0. That is likely also going to be a prob...

9 days ago | 0

Answered

computing potential temperature in atmosphere ?

There are functions for it in the Aerospace Toolbox. See the documentation on the atmoslapse function. It should be straight...

computing potential temperature in atmosphere ?

There are functions for it in the Aerospace Toolbox. See the documentation on the atmoslapse function. It should be straight...

9 days ago | 0

| accepted

Answered

Cannot load data to matlab

It may need the extension as well: load ARG1.mat or: load('ARG1.mat') .

Cannot load data to matlab

It may need the extension as well: load ARG1.mat or: load('ARG1.mat') .

9 days ago | 0

| accepted

Answered

How to create a curve fit for my data?

Assuming you have a vector of ‘T’ values that are functions of ‘s’, ‘g’ is given and the parameter to be estimated is ‘x’: Tf...

How to create a curve fit for my data?

Assuming you have a vector of ‘T’ values that are functions of ‘s’, ‘g’ is given and the parameter to be estimated is ‘x’: Tf...

9 days ago | 0

| accepted

Answered

Plotting error bars on curve from .csv

I am not certain what you want. Try this: x = [1,100,200,300,400,500,600,700,800,900,997]; y = [100.0193,100.218,100.695...

Plotting error bars on curve from .csv

I am not certain what you want. Try this: x = [1,100,200,300,400,500,600,700,800,900,997]; y = [100.0193,100.218,100.695...

9 days ago | 0

Answered

Matlab integration of numerical data

The cumtrapz funciton will likely do what you want, although I am not certain what result you want.

Matlab integration of numerical data

The cumtrapz funciton will likely do what you want, although I am not certain what result you want.

9 days ago | 0

Answered

Filter PPG signal using FIR filter instead of IIR Filter

Try this: Fs = 960; fcomb = [24.5 25]; mags = [1 0]; dev = [0.8 0.1]; [n,Wn,beta,ftype] = kaiserord(fcomb,mags,dev,Fs); h...

Filter PPG signal using FIR filter instead of IIR Filter

Try this: Fs = 960; fcomb = [24.5 25]; mags = [1 0]; dev = [0.8 0.1]; [n,Wn,beta,ftype] = kaiserord(fcomb,mags,dev,Fs); h...

9 days ago | 0

Answered

finding intercept point in the plot

Try this: theta = 50; v0=200; slope= 0.1; vx=v0*cosd(theta); %horizontal component of velocity vector vy=v0*sind(theta); %...

finding intercept point in the plot

Try this: theta = 50; v0=200; slope= 0.1; vx=v0*cosd(theta); %horizontal component of velocity vector vy=v0*sind(theta); %...

9 days ago | 0

| accepted

Answered

how to convert dates in matlab

I have no idea what file format they currently exist in, or how you are reading them. Creating ‘datefile.txt’ from the posted...

how to convert dates in matlab

I have no idea what file format they currently exist in, or how you are reading them. Creating ‘datefile.txt’ from the posted...

10 days ago | 0

Answered

how to add to previous value in matlab

Adding a value to the first element simply requires: a=[1 2 3 4 5] a(1) = a(1) + 2 The ‘... then I want ...’ part does not ...

how to add to previous value in matlab

Adding a value to the first element simply requires: a=[1 2 3 4 5] a(1) = a(1) + 2 The ‘... then I want ...’ part does not ...

10 days ago | 1

| accepted

Answered

How to add numeric values to cell array?

Try this: names = {'A' 'B' 'C' 'D' 'E'}; val = [0;1.5;0.5;0.5;1.5]; C = {[names{:}].' val} C1 = C{:,1} C2 = C{:,2} TC...

How to add numeric values to cell array?

Try this: names = {'A' 'B' 'C' 'D' 'E'}; val = [0;1.5;0.5;0.5;1.5]; C = {[names{:}].' val} C1 = C{:,1} C2 = C{:,2} TC...

10 days ago | 1

| accepted

Answered

what is the problem

Two problems, actually. Use element-wise muultiplication and exponentian operators: fx=exp(x)*sin^2*(x); ↑ ← HERE...

what is the problem

Two problems, actually. Use element-wise muultiplication and exponentian operators: fx=exp(x)*sin^2*(x); ↑ ← HERE...

10 days ago | 0

| accepted

Answered

How to plot graphs with the specific time domain

I am not certain what you want to do. Try this: figure subplot(3,1,1) plot(t((t>=0) & (t<= 2*pi)),f(t((t>=0) & (t<= 2*pi)...

How to plot graphs with the specific time domain

I am not certain what you want to do. Try this: figure subplot(3,1,1) plot(t((t>=0) & (t<= 2*pi)),f(t((t>=0) & (t<= 2*pi)...

10 days ago | 1

Answered

Error using vertcat Dimensions of arrays being concatenated are not consistent. PLEASE HELP

The problem is in the expression for ‘dydt’, since MATLAB interprets the spaces as delimiters. This will throw the reported err...

Error using vertcat Dimensions of arrays being concatenated are not consistent. PLEASE HELP

The problem is in the expression for ‘dydt’, since MATLAB interprets the spaces as delimiters. This will throw the reported err...

10 days ago | 1

| accepted

Answered

finddelay no significant correlation and nan values

The NaN values in the data (note the gaps in the posted plot) are causing problems. Filling them resolves the problems. Try ...

finddelay no significant correlation and nan values

The NaN values in the data (note the gaps in the posted plot) are causing problems. Filling them resolves the problems. Try ...

10 days ago | 0

Answered

Adding date and time on x axes in a plot

There are (at least) two options, depending on what the dates and time are, specifically with respect to the type of arrays they...

Adding date and time on x axes in a plot

There are (at least) two options, depending on what the dates and time are, specifically with respect to the type of arrays they...

10 days ago | 0

Answered

Converting matrix multiplication into element-wise multiplication

I am not certain what you are doing, however it appears that using matlabFunction to convert the symbolic code to a form that ca...

Converting matrix multiplication into element-wise multiplication

I am not certain what you are doing, however it appears that using matlabFunction to convert the symbolic code to a form that ca...

10 days ago | 0

| accepted

Answered

shaded confidence interval plotting with shade area (patch)

The data in ‘data-confidence interval.xls’ are read in as column vectors, so fliplr simply flips a column vector, and accomplish...

shaded confidence interval plotting with shade area (patch)

The data in ‘data-confidence interval.xls’ are read in as column vectors, so fliplr simply flips a column vector, and accomplish...

10 days ago | 0

| accepted

Answered

What is the difference between the plots of the following commands.

The second one draws the complete Bode plot (magnitude spectrum and phase spectrum) and plots it as a function of the angular fr...

What is the difference between the plots of the following commands.

The second one draws the complete Bode plot (magnitude spectrum and phase spectrum) and plots it as a function of the angular fr...

10 days ago | 0

Answered

Find the frequency for signals by using FFT

One approach (I recognise my code from some previous Answer, so I’ll supply the rest of it): T1 = readtable('signals.xlsx', 'V...

Find the frequency for signals by using FFT

One approach (I recognise my code from some previous Answer, so I’ll supply the rest of it): T1 = readtable('signals.xlsx', 'V...

10 days ago | 1

| accepted

Answered

Mesh plot of the function sqrt(y-x^2)

Try this: x = -3:1:3; y = 0:1:9; [X, Y] = meshgrid(x,y); Y = Y.*(Y>=X.^2); % Select Y ≥ X^2 Z = sqrt...

Mesh plot of the function sqrt(y-x^2)

Try this: x = -3:1:3; y = 0:1:9; [X, Y] = meshgrid(x,y); Y = Y.*(Y>=X.^2); % Select Y ≥ X^2 Z = sqrt...

11 days ago | 1

| accepted

Answered

Legend and scaled plot

The third argument to scatter will vary the circle sizes according to whatever variable vector is specified, and the fourth argu...

Legend and scaled plot

The third argument to scatter will vary the circle sizes according to whatever variable vector is specified, and the fourth argu...

11 days ago | 1

| accepted

Answered

Fminsearch in a for loop

The code borders on being indeciperable. Do not use global variables. See Passing Extra Parameters for the correct way to p...

Fminsearch in a for loop

The code borders on being indeciperable. Do not use global variables. See Passing Extra Parameters for the correct way to p...

11 days ago | 0

| accepted