Answered
Error trying to implement a 1-D fast fourier Transform
After a fair amount of editing (please proofread your code), this works: A = 7; P = 100; M = 15; t = 0:1:sym(P); % Signal d...

6 years ago | 0

Answered
How to minimize a nonlinear function?
It took a bit to correct the parentheses problems in ‘myfun’. With that solved: myfun = @(x1,x2,x3) (1./(1+(x1-x2).^2)) + s...

6 years ago | 0

Answered
How to compare between two surface plots in matlab?
Perhaps: figure(1) surf(X,Y,A, 'FaceAlpha',0.5) hold on surf(X,Y,B, 'FaceAlpha',0.5) hold off .

6 years ago | 0

| accepted

Answered
How can i fix this ode45 error: Not enough input arguments.
Try this: syms x1 x2 t x1_dot = (6*atan((53*x1)/9))/(25*pi) - 40*x1 + (6*atan((179*x2)/18))/(25*pi); x2_dot = (6*atan((53*x...

6 years ago | 0

| accepted

Answered
how do i convert a dataset to matrix?
Using two lines of the posted file, this textscan call appears to read each of them (presented individually, since I prefer not ...

6 years ago | 0

| accepted

Answered
How do I organize a table using a specified cell array?
One approach is to use the findgroups function: load patients T = table(Age,Gender,Height,Weight,Smoker,... 'RowNames'...

6 years ago | 0

| accepted

Answered
Conditional equations with cell arrays.
In one line with ‘logical indexing’: y = {0 0 0 -179.4 0 -179.3 -178.3 -173.2 -178.9 -179.6}; x = {173.5 169.4 177.5 172.8 1...

6 years ago | 0

| accepted

Answered
Fit data to Monod-type kinetics and Confidence Intervals of parameters
See: Monod kinetics and curve fitting (An oldie but a goodie!) It uses lsqcurvefit, so you can use nlparci with the results...

6 years ago | 1

| accepted

Answered
How can I decompose a time series in linear Trend, Residual and Seasonal trend?
I have no idea how those are calculated, or how the trend is calculated. On option is likely the timeseries version of detrend,...

6 years ago | 0

Answered
solve with known variables
With the values you provided, ‘eqn2’ equates to 0, so there is nothing to solve for. That aside, you are solving one equation...

6 years ago | 0

| accepted

Answered
Ideal Soliton Distribution code
I never heard of this distribution before, so I have no idea what its properties should be. See if this does what you want: ...

6 years ago | 1

| accepted

Answered
OLS estimator b=x\y?
‘What is difference between these two expressions?’ The way they are implemented in MATLAB. The documentation for mldivide,\...

6 years ago | 0

| accepted

Answered
Inverse laplace transform from system identification data
First, simplify the result, use vpa to eliminate the fractions in the symbolic result, then use matlabFunction to produce an ano...

6 years ago | 0

| accepted

Answered
Interpolation from a table
Try this: T = [1.2600 1.0000 0.7400 0.5340 0.3720 0.2410 0.1490 0 1.1710 0.9340 0.6970 0.5060 0.3550 0.2310 ...

6 years ago | 0

Answered
How to display the value of a function?
I am not exactly certain what you want. Try this: h = 42; alpha = pi; At = 0.25*h^2/alpha; fprintf('\n%.2f = 0.25 * %.2f...

6 years ago | 0

Answered
How can I plot an ECG txt file for analysis on Matlab?
First, read it and assign the variables: D = readmatrix('ECG_10.11.20_11.57.59.txt', 'HeaderLines',6); EKG = -D(:,1); ...

6 years ago | 0

| accepted

Answered
How to Plot a second derivative equation?
Try this: syms x(t) equ(t) Dx = diff(x); D2x = diff(x,2); w = 1 % dt = 1/1000; % t = 0:dt:1000*dt; ...

6 years ago | 0

| accepted

Answered
plot square-wave sine grating
To change a sine wave to a square wave, use the sign function: t = linspace(0, 5, 250); f = 2; sinwav = sin(2*pi*t*f); sqrw...

6 years ago | 2

Answered
Is there a code to take values from the fprintf ?
Since you are printing to the Command Window and not a file, likely not. However ‘stress’ is obviously in your workspace, so ...

6 years ago | 0

| accepted

Answered
matlab getting a y value from x
Assuming that the equations do not have unique inverses, use interp1 with the numerical results of each equation, with: xi = i...

6 years ago | 0

| accepted

Answered
Parameter Estimation for a System of Differential Equations
See the identically-titled Parameter Estimation for a System of Differential Equations for a working solution. You will need t...

6 years ago | 0

| accepted

Answered
Changing the x-axis from Time instead samples
When I run yoiur code in R2020b, the x-axis is labeled ‘Time (ms)’. To convert them (and the x-axis label) to seconds: fs =...

6 years ago | 1

| accepted

Answered
the use of the text function.
This does work, however you may want to reconsdier how you want it to appear: x = 0:pi/40:4*pi; figure plotyy(x, sin(x), x...

6 years ago | 0

| accepted

Answered
I need to plot the vector field from a Matrix
See Plot Gradient and Contours for an example of how to use matrices with quiver.

6 years ago | 0

Answered
how to get 2d line of surface plot section view
Try this: [X,Y,Z] = peaks(50); % Create Surface Data figure surf(X,Y,Z) grid o...

6 years ago | 0

| accepted

Answered
fplot in Matlab error
Note that ‘sol1’ is a function of both ‘C’ and ‘t’. Since ‘C’ is undefined, fplot throws the error. One option is to use anoth...

6 years ago | 0

Answered
I am having trouble making a movie from an image I have rotating
The getframe (and related functions) will help you do what you want. You will need to explore them and use those that apply t...

6 years ago | 0

Answered
How to display which number in a string of text applys to an if command?
Try this: v = [12 35 46 1 4 1.3 0]; loc = find(v <= 2) producing: loc = 4 ...

6 years ago | 0

| accepted

Answered
Derivate using chain rule doesn't work in MATLAB
This works for me: syms f(x) r(x) x dfr = diff(f(x)*r(x)) producing: dfr = f(x)*diff(r(x), x) + r(x)*diff(f(x), x) that...

6 years ago | 0

Answered
Filter rows based on presence of string
If you have R2015b or later use the findgroups function. Otherwise, use the third output of the unique function to do the same ...

6 years ago | 0

Load more