Answered
ODE45; Length of initial conditions vector not accepted
See if this does what you want: function ddx = odefcn(t,v,W,k,rho,S,R,m,P,c_Do) A_0 = (4.654*W*cos(t)*k)/(rho*S) - W*sin(...

4 days ago | 0

| accepted

Answered
Problems using a Butterworth filter instead of a bandstop to filter frequencies.
You are not designing the filter correctly. Try this instead: lfreq = 170; ...

4 days ago | 0

| accepted

Answered
How to put a numerical value inside a Bar graph?
Change the text call to: text(1:length(Y),Y/2,num2str(Y'),'vert','bottom','horiz','center'); % values position That should w...

4 days ago | 0

| accepted

Answered
How would I simulate this in Matlab?
I would approach it as a compartmental modeling problem. Plants grow at a specific rate, however some will die (for whatever ...

5 days ago | 0

Answered
How do I produce graphs from 'for' loop?
Use the hold function. figure hold on <LOOP> hold off If you are plotting single points in each loop iteration (not possi...

5 days ago | 0

| accepted

Answered
tf2ss not returning the correct State Space form
The result is correct. The exact configuration doesn’t matter, so long as all the matrices and vectors work together (and produ...

5 days ago | 0

| accepted

Answered
How do I generate a polynomial from roots that are repeated?
Iinteresting. I would expect no repeats, and complex conjugate values instead. Try this: rts = [ -0.7437 - 1.4178i ...

5 days ago | 0

| accepted

Answered
add standard deviation value and text on bars
When I try to run your code, I get: Unrecognized function or variable 'X'. In its absence, try this: Y=[0.9 0.83 0.700;1.58...

5 days ago | 1

Answered
ODE symbolic result plotting with fplot()
I am not certain what the problem is with the original function. If you simplify it first: phi = vpa(simplify(phi, 'Steps',...

5 days ago | 0

| accepted

Answered
solve 3 order differential equations
Without seeing your ODE solver call, I cannot determine what the problem is. This runs without error for me (in R2020b): ...

5 days ago | 0

Answered
How can I mark wheezes on a plot?
Try something like this: wheezes = sort(randi(100, 10, 1)); % Create Data ws...

6 days ago | 1

Answered
Fprintf modification in matlab
Those are all preferences. See the Fonts section. There is no other way (to my knowledge) to change them. Also, I poste...

6 days ago | 0

Answered
Need help.... How to plot sequences
The mod function and the colon,: operator are your friends!

6 days ago | 0

| accepted

Answered
sampling time causes scaling of simulation results.
It may be appropriate to specify the the sampling time in the ss call. See Create Discrete-Time State-Space Model. Another p...

6 days ago | 0

Answered
How can we do for following fprintf formating
Try this: fprintf('\tx%c\n', char(178)) producinig: x² .

6 days ago | 0

| accepted

Answered
How to plot point clouds and linear regression line in the same plot?
Use the hold function.

7 days ago | 0

Answered
How to Solve an Equation with an Integral for the Integral Range Parameter?
The gammainc function does not take complex arguments, so this is likely the best you can hope for: F = @(S) S - 0.01 * gammai...

7 days ago | 0

| accepted

Answered
ODE45 to solve a 2nd order differential equation with a parameter that changes in time
Interp[olate to find the appropriate values of ‘heave’ (that I call ‘heavet’ in ‘pitchODE’ ‘dxdt2’): function [dxdt] = pitchOD...

7 days ago | 1

| accepted

Answered
Percentiles without Statistics Toolbox
Try this: x = 3*randn(1,100)+5; % Create Data figure yyaxis left h = hi...

7 days ago | 0

| accepted

Answered
error with function bode
Rename your ‘conv.m’ file to something else, perhaps to ‘myconv.m’ or to something else that makes sense in the context of its u...

7 days ago | 0

Answered
Sorting time in 1 hour time slots.
One approach: A = datetime([zeros(100,4) randi(1440, 100, 1) zeros(100,1)]); % Create Data [H,~,ix] = unique(hour(A)...

8 days ago | 0

Answered
why is my plot plotting blank?
The value of ‘Cd’ is 0 in the code you posted, so ‘y’ is uniformly -Inf.

8 days ago | 0

Answered
How to get spatial frequency from FFT?
The Fourier transform neither knows nor cares whether the units of the independent variable are time, space, or anything else. ...

8 days ago | 0

| accepted

Answered
How to plot particle trajectories and normalise to 0,0 origin?
This will normalise everycell to begin at (0,0): testdata = readmatrix('Amadeus Xu testdata.xlsx'); [Uid,~,ix] = unique(testd...

8 days ago | 1

| accepted

Answered
How can I mix two signals in MATLAB?
Ther esult would appear to be a single-sideband suppresed-carrier signal (with only the upper sideband). See if the demod funct...

9 days ago | 0

Answered
How can I import from Excel CSV
Use readtable to read it: T1 = readtable('sample.csv', 'VariableNamingRule','preserve', 'HeaderLines',22); The 'Headerlines' ...

9 days ago | 0

| accepted

Answered
Smoothening the data of Iv loop
That looks like a hysteresis loop. See if the approach in how to find ascending and descending of hysteresis loop? will fit it ...

9 days ago | 0

| accepted

Answered
Fitting data with multiple inputs, ODE equation, and lsqnonlin
The fundamental problem is that lsqnonlin ~= lsqcurvefit! They are definitely not interchangable, and have different argument l...

9 days ago | 1

| accepted

Answered
Matlab not recognizing dates
You did not mention how you were importing them. Try importing them this way: dv = {'202011' '202012'} datetime(d...

10 days ago | 0

| accepted

Answered
How to generate one square pulse?
Try this: sqpuls = @(t,t1,t2) (t>= t1) & (t <= t2); t = linspace(-1, 1); figure plot(t, sqpuls(t, -0.5, 0.5), '-r') gr...

10 days ago | 0

Load more