Answered
I don't understand why the elements are not the same on both sides
The reason is that ‘t’ needs a subscript: x(n+1) = x(n) + h * ((8*(x(n))/(t(n)+1))-(t+1)*(x(n)^2)); ...

5 years ago | 0

| accepted

Answered
Adding a new column to a table
One approach: T1 = table(randi([330 470],10,1), 'VariableNames',{'QTcorrected'}); % Create Data QTc = @(x) 1*...

5 years ago | 1

Answered
How to Segment EMG data into time intervals
One option is the Signal Processing Toolbox buffer function. It uses samples as one of its arguments, however that is straigh...

5 years ago | 0

| accepted

Answered
Coupled rate ODEs with ode45
The concentrations change appropriately, however they don’t change much and the concentrations are vanishingly small. That’s th...

5 years ago | 0

| accepted

Answered
Figure line won't connect/display all data points
Isolated points only plot if specified as markers. Try this: D1 = load('midpoint.mat'); midpoint = D1.midpoint_overlap_seq...

5 years ago | 0

| accepted

Answered
How to solve this equation?
Probably the easiest approach: syms h z2 Eqn = h^0.66+0.0805*h == 0.045; [h,prms,cndx] = solve(Eqn,h, 'ReturnConditions',1)...

5 years ago | 0

Answered
ode45: use span of length 2
The tspan argument can be anything you want it to be (within limits). To have ode45 to evaluate and output at only those valu...

5 years ago | 0

Answered
confusing error message: 'Not enough input arguments'?
With a function in that format, it is necessary to pass a function handle to lsqnonlin (or any other function that takes a funct...

5 years ago | 0

| accepted

Answered
How to plot only the real solutions of an implicit function ?
Nothing is being generated: R = 0.35; L = 0.25; H = 0.4; f1 = @(x,y) sqrt(L^2-(R*(cosd(x)-sind(x).*sind(y))-H).^2); figu...

5 years ago | 1

Answered
Plot and calculate Damping ratio
The findpeaks or islocalmax functions can return the information to do the calculations.

5 years ago | 1

Answered
Trouble taking the differential of a function
‘What am I missing here?’ Most likely, using the Symbolic Math Toolbox. Try this: syms E I L w_0 x func(x) = (((w_0*L)...

5 years ago | 0

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...

5 years ago | 0

| accepted

Answered
Fit 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...

5 years 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);...

5 years 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...

5 years 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*...

5 years 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 ...

5 years 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...

5 years 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...

5 years 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]; ...

5 years 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(...

5 years 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? ...

5 years 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*...

5 years 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...

5 years 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).

5 years ago | 1

| 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...

5 years 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.

5 years 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 = ...

5 years ago | 2

| 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 =...

5 years 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...

6 years ago | 1

Load more