Answered

Help with Errorbars on Bar Graph

Try this: AngleFlex90 = [95 99; 93.33 80; 95.67 99.33]; AngleError = [8.9 6.6; 7.6 5; 4 1.2].'; figure hBar = bar(Angle...

Help with Errorbars on Bar Graph

Try this: AngleFlex90 = [95 99; 93.33 80; 95.67 99.33]; AngleError = [8.9 6.6; 7.6 5; 4 1.2].'; figure hBar = bar(Angle...

6 days ago | 0

| accepted

Answered

Gaussian Fit for x and y data

Try this: D1 = readmatrix('Test1.xls'); x = D1(:,1); y = D1(:,2); gausfcn = @(b,x) b(1).*exp(-(x-b(2)).^2/b(3)); [maxy,i...

Gaussian Fit for x and y data

Try this: D1 = readmatrix('Test1.xls'); x = D1(:,1); y = D1(:,2); gausfcn = @(b,x) b(1).*exp(-(x-b(2)).^2/b(3)); [maxy,i...

6 days ago | 0

| accepted

Answered

Shade the region between the lines and xy axis

Try this: x=linspace(-2,8); y1=@(x)(8-2*x); y3= @(x)(5+2.5*x); y4=@(x)(0*x); y5=xline(0); y1_xint = fzero(@(x) y1(x), 1);...

Shade the region between the lines and xy axis

Try this: x=linspace(-2,8); y1=@(x)(8-2*x); y3= @(x)(5+2.5*x); y4=@(x)(0*x); y5=xline(0); y1_xint = fzero(@(x) y1(x), 1);...

6 days ago | 0

| accepted

Answered

Find index of value in array

It is not obvious to me how the number of subjects and the repitition time interact, however it is unlikely that a loop is neces...

Find index of value in array

It is not obvious to me how the number of subjects and the repitition time interact, however it is unlikely that a loop is neces...

6 days ago | 0

| accepted

Answered

what is the reason of an empty diagram?

It is likely necessary to index the variables appropriately. Try this: xdot10=-(1/m_c)*(k_ss*(x(:,9)-x(:,5)+r*x(:,7))+c_ss*...

what is the reason of an empty diagram?

It is likely necessary to index the variables appropriately. Try this: xdot10=-(1/m_c)*(k_ss*(x(:,9)-x(:,5)+r*x(:,7))+c_ss*...

6 days ago | 0

| accepted

Answered

Need help solving a system of 2 second-order differential equations using ode45

I am not certain what you want. This assignment: thetaVec = deval(thetaVals,tVec,1); returns the value of ‘theta’ for the ...

Need help solving a system of 2 second-order differential equations using ode45

I am not certain what you want. This assignment: thetaVec = deval(thetaVals,tVec,1); returns the value of ‘theta’ for the ...

6 days ago | 0

Answered

how to solve 2nd order coupled system of differential equations with heaviside function using ode45 solver?

Numerical ODE solvers do not do well across non-differentiable discontinuities. The heaviside function in MATLAB is differentia...

how to solve 2nd order coupled system of differential equations with heaviside function using ode45 solver?

Numerical ODE solvers do not do well across non-differentiable discontinuities. The heaviside function in MATLAB is differentia...

6 days ago | 0

Answered

Convert Excel to Timetable

‘I attached the excel sheet as well ...’ Not yet. The readtimetable function may be appropriate if you have R2019a or la...

Convert Excel to Timetable

‘I attached the excel sheet as well ...’ Not yet. The readtimetable function may be appropriate if you have R2019a or la...

7 days ago | 0

Answered

set the vector same length

The approach depends on what you want as the result: x = [2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016]; ...

set the vector same length

The approach depends on what you want as the result: x = [2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016]; ...

7 days ago | 0

Answered

How to get the first value in a set of array that is bigger than the first few values?

Try this: y = [1 1 1 1 1 1.5 1.7 1.9 2 2.7]; x = [25:35]; TF = ischange(y,'variance'); Idx = find(TF,1,'first') Out = x(...

How to get the first value in a set of array that is bigger than the first few values?

Try this: y = [1 1 1 1 1 1.5 1.7 1.9 2 2.7]; x = [25:35]; TF = ischange(y,'variance'); Idx = find(TF,1,'first') Out = x(...

8 days ago | 0

| accepted

Answered

Combining repetitive curves into one average curve

One option is to do something similar to the approach in How do I find and plot the average of action potentials from a trace? ...

Combining repetitive curves into one average curve

One option is to do something similar to the approach in How do I find and plot the average of action potentials from a trace? ...

8 days ago | 1

| accepted

Answered

Help translating this expression to Matlab

My best guess: y = (exp(3*t) + t.^2.*sin(4*t)).*cos(3*t).^2; or as an anonymous function: y = @(t) (exp(3*t) + t.^2.*sin(4*...

Help translating this expression to Matlab

My best guess: y = (exp(3*t) + t.^2.*sin(4*t)).*cos(3*t).^2; or as an anonymous function: y = @(t) (exp(3*t) + t.^2.*sin(4*...

8 days ago | 0

Answered

How to integrate with distribution function?

That looks like a version of the Lognormal Distribution. It would likely be best to code the ‘M’ result as a function of ‘H’, a...

How to integrate with distribution function?

That looks like a version of the Lognormal Distribution. It would likely be best to code the ‘M’ result as a function of ‘H’, a...

8 days ago | 0

Answered

"Invalid interpolation method" after moving to MATLAB2020b

See method in the interp1 documentation (R2020b, however I doubt if it’s changed significantly since R2018b).

"Invalid interpolation method" after moving to MATLAB2020b

See method in the interp1 documentation (R2020b, however I doubt if it’s changed significantly since R2018b).

8 days ago | 0

| accepted

Answered

timetable to wav file

I never did anything similar, so this is simply the approach I’d try first. Perhaps first timetable2table then table2array, t...

timetable to wav file

I never did anything similar, so this is simply the approach I’d try first. Perhaps first timetable2table then table2array, t...

9 days ago | 0

| accepted

Answered

How do I find the start and stop indexes of non-zero segments of a matrix?

The ischange function could be helpful. A related Signal Processing Toolbox function is findchangepts.

How do I find the start and stop indexes of non-zero segments of a matrix?

The ischange function could be helpful. A related Signal Processing Toolbox function is findchangepts.

9 days ago | 0

Answered

Converting magnitude (dB) and phase (deg) to complex value

Try this: complexVector = [10.^(mag_dB/20) .* exp(1j*deg2rad(phase_degrees))] or as an anonymous function: complexVector = ...

Converting magnitude (dB) and phase (deg) to complex value

Try this: complexVector = [10.^(mag_dB/20) .* exp(1j*deg2rad(phase_degrees))] or as an anonymous function: complexVector = ...

9 days ago | 1

| accepted

Answered

Different Approach to solve ODE

I have no idea how the ‘Linear Damping Response’ section figures into this. However: syms t x(t) Y Dx = diff(x); ode =...

Different Approach to solve ODE

I have no idea how the ‘Linear Damping Response’ section figures into this. However: syms t x(t) Y Dx = diff(x); ode =...

9 days ago | 0

| accepted

Answered

Attempting to plot a 3 x 3 grid of plots

Try something like this: time = linspace(0,2*pi); response = @(Kp,Kd) sin(time*Kp) .* cos(time*Kd); Kp = [2.4 180 250]; K...

Attempting to plot a 3 x 3 grid of plots

Try something like this: time = linspace(0,2*pi); response = @(Kp,Kd) sin(time*Kp) .* cos(time*Kd); Kp = [2.4 180 250]; K...

10 days ago | 1

Answered

Plotting help with a simple problem

Subscript all of them. Try this: a=750000; %staring amount b=35000; %starting withdrawl y=0; %years while a>b ...

Plotting help with a simple problem

Subscript all of them. Try this: a=750000; %staring amount b=35000; %starting withdrawl y=0; %years while a>b ...

10 days ago | 1

| accepted

Answered

Finding lowest value and the index from vector excluding zero and inf

Try this: x = [1 3 2;-1 inf 0.5]; [r,index] = min(x(x>0)) producing: r = 0.5 index = 5...

Finding lowest value and the index from vector excluding zero and inf

Try this: x = [1 3 2;-1 inf 0.5]; [r,index] = min(x(x>0)) producing: r = 0.5 index = 5...

10 days ago | 0

| accepted

Answered

Way to visualise system of ODEs

Try your code with these changes: [V1,Sbs] = odeToVectorField(ODE1,ODE2); F1 = matlabFunction(V1,'vars',{'t','Y'}); ...

Way to visualise system of ODEs

Try your code with these changes: [V1,Sbs] = odeToVectorField(ODE1,ODE2); F1 = matlabFunction(V1,'vars',{'t','Y'}); ...

10 days ago | 0

| accepted

Answered

How to have 2D bar on side of 3D plot?

See if subplot or tiledlayout (introduced in R2019b) will do what you want. That is likely the closest it’s possible to get.

How to have 2D bar on side of 3D plot?

See if subplot or tiledlayout (introduced in R2019b) will do what you want. That is likely the closest it’s possible to get.

10 days ago | 0

Answered

Fit data to a sinusoidal curve

One option is to see if the approach in Curve fitting to a sinusoidal function does what you want.

Fit data to a sinusoidal curve

One option is to see if the approach in Curve fitting to a sinusoidal function does what you want.

10 days ago | 0

Answered

Offset removal from a sinusoidal wave

Try this: D1 = readmatrix('Output.csv'); x = 1:numel(D1); D1HL = min(D1(D1>0)); D1HI = (D1>D1HL); ...

Offset removal from a sinusoidal wave

Try this: D1 = readmatrix('Output.csv'); x = 1:numel(D1); D1HL = min(D1(D1>0)); D1HI = (D1>D1HL); ...

10 days ago | 1

| accepted

Answered

Help with the integral function

It appears that what you want to integrate could be vectors, not functions. If so, use the trapz (or cumtrapz) function to do a...

Help with the integral function

It appears that what you want to integrate could be vectors, not functions. If so, use the trapz (or cumtrapz) function to do a...

10 days ago | 0

Answered

HOW TO NORMALIZE MATRIX BASED ON COLUMNS' MAX VALUE?

Try this: N = normalize(T,'norm',Inf,'DataVariables',{'Height', 'Age'}) Put multiple variables in a cell array (note the curl...

HOW TO NORMALIZE MATRIX BASED ON COLUMNS' MAX VALUE?

Try this: N = normalize(T,'norm',Inf,'DataVariables',{'Height', 'Age'}) Put multiple variables in a cell array (note the curl...

10 days ago | 0

Answered

Solving an overdetermined set of simultaneous equations

There is no symbolic solution. If you want to experiment with it, one option is: syms e0 e1 e2 T1 T2 T3 T4 T5 TM1 TM2 TM3 T...

Solving an overdetermined set of simultaneous equations

There is no symbolic solution. If you want to experiment with it, one option is: syms e0 e1 e2 T1 T2 T3 T4 T5 TM1 TM2 TM3 T...

11 days ago | 1

Answered

Numerical integration using cumtrapz

The cumtrapz function integrates a vector, and ideally, the dependent variable vector with respect to the independent variable v...

Numerical integration using cumtrapz

The cumtrapz function integrates a vector, and ideally, the dependent variable vector with respect to the independent variable v...

11 days ago | 0

| accepted

Answered

How do i get my answer to print into a table format instead of a single line

Your code is close. Use tab characters ('\t') and carriage return-newline ('\n') characters as appropriate: fprintf(fid,'\t\t...

How do i get my answer to print into a table format instead of a single line

Your code is close. Use tab characters ('\t') and carriage return-newline ('\n') characters as appropriate: fprintf(fid,'\t\t...

12 days ago | 0