Answered
Trying to solve a differential equation
Add ‘Fmag’ to the syms declaration to get — .

5 years ago | 0

| accepted

Answered
Interpolating between end points in polar coordinates
Try this: polcords = [13.7807 208.5120 13.9924 225.4886 19.3740 232.1227 14.2353 26...

5 years ago | 1

Answered
Transfer function fit estimate
I’m not certain exactly what you’re plotting. I always use the compare function to see how closely the estimated system matches...

5 years ago | 0

| accepted

Answered
To define the frequency range when we use FFT
First, change ‘t’ to: t=linspace(0, 300, 600); % Needs To Be Regularly-Spaced then for a t...

5 years ago | 0

| accepted

Answered
Stack three area plots - MATLAB
This approaches what you want, however there must be some sort of conservation metric or other sort of scaling necessary to get ...

5 years ago | 0

| accepted

Answered
how can i fix this error
I have no idea if ‘x’ is a variable or a function, so I am assuming that it is a variable here. The correct expression would ...

5 years ago | 0

Answered
Nonlinear fval, fsolve
Pass ‘A’-‘D’ to ‘mufun’ as extra arguments: function F = mufun(x,A,B,C,D) F = [(1./A)*(x(1)-x(2))-x(3); (-1./A)*(x(1)-x(...

5 years ago | 0

Answered
Please change this code from inline to function.
This is straightforward — f1=inline('2*x.^3+y.^3+x.*y-6'); f2=inline('x.^3-y.^3+x.*y-4;'); magickally becomes — f1 = @(x,y...

5 years ago | 0

| accepted

Answered
interp1 question for resampling
To prevent the NaN results from being part of the interp1 output, specify an interpolation method and use the 'extrap' argument....

5 years ago | 1

| accepted

Answered
plotting line graph in different colors using while loop
This is relatively straightforward to do with scatter, however plot will not work with it. colrfcn = @(x) (x(:)<2.65).*[0 1 0...

5 years ago | 0

| accepted

Answered
How do I plot a 144000 sample sound file with 400 samples in different windows with for loop?
If ‘y’ is the signal, and you have the Signal Processing Toolbox, use the buffer function: framelen = 400; frames = buffer(y,...

5 years ago | 0

Answered
Trouble solving ODE equations
There were several missing multiplication operators, and a reference to ‘BF2’ that I corrected to ‘F2’, since there is no ‘B’ th...

5 years ago | 0

Answered
How can I use filloutliers for a table with time and data in Matlab?
Converting it to a timetable first may solve that problem. See the filloutliers documentation section on A since it appears tha...

5 years ago | 1

Answered
Symbolic printing without extensive decimals
Set digits to whatever value you want: syms x f=x*1231871.1561876*5618965/3156651894-561894+4849159*15844/5189; digits(5) l...

5 years ago | 0

| accepted

Answered
FFT Function from Table
There could be NaN values in the column (at least that’s my assumption). In that event, the fillmissing funciton will interpo...

5 years ago | 0

Answered
How to format a cell array to different rows
Try this: fidi = fopen('testdata.txt', 'rt'); C = textscan(fidi, '%f', 'Delimiter',' ', 'MultipleDelimsAsOne',1); % Cell Arra...

5 years ago | 0

| accepted

Answered
How to solve an iteration problem for a formula in which there is the same variable on both sides (LHS and RHS)
The approach is to subtract the LHS from the RHS, and solve for the function equalling 0. Perhaps something like this: F = ...

5 years ago | 0

Answered
How to get only a part of the convhull line?
One approach is to select only those points that are common to an ‘x’ (independent variable) value less than some threshold. ...

5 years ago | 0

Answered
LPF with notches at 50hz and all other harmonics
I am assuming that the sampling frequency is 2 kHz, and the magnitude spectrum in the image goes to the Nyquist frequency of 1 k...

5 years ago | 0

| accepted

Answered
How to Plot for multiple values of a variable
It would likely be easiest to define ‘G’ as a vector: Gv = [1.4,1.66, 1.8]; and then add an additional loop for it: for k =...

5 years ago | 0

Answered
Differentiating a Symbolic Function
That is the corrct result, since diff is taking the partial derivative with respect to ‘x’ only, and ‘y’ is considered a constan...

5 years ago | 0

| accepted

Answered
Calculation of derivative of a waveform
Use the gradient function. That appears to be relatively noise-free, so gradient should produce a useful result. If noise is...

5 years ago | 1

| accepted

Answered
Table calculations, annual return
Assuming that you created the table called ‘T1’ correctly and that it contains variables (columns) named ‘AAPL’, ‘AMZN’ and the ...

5 years ago | 0

| accepted

Answered
How can i detect cardiac axis from ECG signal?
Use Standard Lead for the x-axis, Augmented Lead for the y-axis, and go from there. Calculate the angles using atan2d and the...

5 years ago | 1

Answered
How to Merge Color using "Area" Command?
With respect to patch, set 'FaceAlpha'; of both to 0.5 (or anything less than 1) to see the two patches overlap, with appropriat...

5 years ago | 0

| accepted

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.

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

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

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

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

5 years ago | 0

Load more