Answered
LinearRegression with 20 columns features ~ Label
If the data are in a table, it is possible to use the Wilkinson notation, as described in the doeucmnetaion section Fit Linear R...

5 years ago | 0

Answered
How to compute matrix exponential for each cell array and then multiply these matrix exponential with each other?
This will probably work: Mn=expm(a1{:})*expm(a2{:})*expm(a3{:})*expm(a4{:})*expm(a5{:})*expm(a6{:})*expm(a7{:})*expm(a8{:})*ex...

5 years ago | 0

| accepted

Answered
Call a function with multiple nonlinear eqns with ODE45
There were a number of errors that I corrected. This runs and produces what appears to be appropriate output: tspan = [0 15...

5 years ago | 1

| accepted

Answered
Inductance of a Transmission Line
The error I get is: Operator './' is not supported for operands of type 'cell'. because of: mu0 = {4.*pi.*1e-7}; Since the...

5 years ago | 1

| accepted

Answered
Adding text from calculated functions and line of best fit to scatter plot
To display the information on the plot, use the text function. The sprintf or compose functions can also be helpful, dependin...

5 years ago | 0

| accepted

Answered
Invalid data type. First argument must be double, single, int8, uint8, int16, uint16, int32, uint32, or logical. Error
Since ‘y’ is a symbolic expression, it is not an appropirate argument for fft. However, all is not lost! First, get the ‘x’ ...

5 years ago | 1

| accepted

Answered
Bode 3 dB down point
Use the bandwidth funciton: fb = bandwidth(sys) producing: fb = 510.290495078091 It does not work al all object...

5 years ago | 0

Answered
Function handle issue regarding Trig Fourier Series
In this situaiton, it is necessary to evaluate the function, and also use the 'ArrayValued' name-value pair: for n=1:N an...

5 years ago | 1

Answered
How to change size of graph
If the objective is to re-scale all the values so that the highest is 100, then: Y = (Y-min(Y,0)) * 100/max(Y); would likely ...

5 years ago | 2

| accepted

Answered
How to use lsqcurvefit for a sine wave?
The ‘fun’ function applies the scaling factor ‘A(1)’ to the sin call and the offset, ‘A(4)’. Those should likely be separate. ...

5 years ago | 1

| accepted

Answered
How to fill between two lines?
It appears from the nanmean and nanstd calls that the results of ‘meanpt’, ‘means’, and the others are all column vectors, so fl...

5 years ago | 0

Answered
Function after spline fitting
The easiest way to fit it to a sin or cos function (or both) to it would be to take the Fourier transform of it using the fft fu...

5 years ago | 0

Answered
how can i plot this 2 variable maths equation on a 3d plot
Try this: thetav = linspace(0, 2*pi, 50); lambdav = linspace(0, 10, 25); [Th,Lb] = ndgrid(thetav, lambdav); Z = @(theta,lam...

5 years ago | 0

Answered
How can I draw 95% CI plot in my data?
Replace the second plot call with: patch([x, fliplr(x)], [yCI95(1,:) fliplr(yCI95(2,:))], 'b', 'EdgeColor','none', 'FaceAlpha'...

5 years ago | 2

| accepted

Answered
Syms and solver help
The code apparently works (although ‘C’ is missing, and since double does not allow for symbolic variables to be present, ‘S’ wi...

5 years ago | 0

| accepted

Answered
Getting a single solution, but expecting an array
Missed one element-wise division: Z_in = (r_s + j*L_ls) + (j*L_m*(r_r./s + j*L_lr))./(j*L_m + r_r./s + j*L_lr) ...

5 years ago | 0

| accepted

Answered
RMS-EMG calculate and plot
The RMS value needs to be calculated for a vector. Since the RMS =s the square root of the mean of the squared values of that v...

5 years ago | 1

| accepted

Answered
error with pdist2 column mismatch
If ‘basestation’ is a (50x50) matrix, and the distance calculation is to be with a 2-column array, that is going to be a problem...

5 years ago | 0

| accepted

Answered
Number of peak values from the plot
Use findpeaks with outputs: [pks,locs] = findpeaks(time,engine_state); The number of peaks will be: numPeaks = numel(pks) ...

5 years ago | 0

| accepted

Answered
error with sprintf add operation between 2 terms resulting in string
‘I used sprintf because that's the only command i know of ,to get from Mt1a= 2.152845579898380e+05 toMt1a=215285.’ They are ...

5 years ago | 1

| accepted

Answered
How to save output?
Try this: n = 10; x=[0:n-1]; y=[0:n-1]; k = 0; % <- ADD figure f...

5 years ago | 0

| accepted

Answered
Solving equation with tan
Here is how I would solve it: fcn = @(x) 125-atand(0.25.*x)-0.2*x*180/pi; est_x = fzero(fcn, 10) producing: est_x = 5...

5 years ago | 0

| accepted

Answered
find intersection of 2 graphs in one plot with unknown function
It would help to have the actual data. This simply requires basic MATLAB functions: A = [0:20; (0:20).^2; 100-(0:20).^1.5]....

5 years ago | 0

Answered
I want to know how to do least squares regression.
See the documentation on mldivide,\ for one approach.

5 years ago | 0

Answered
How to lookup for values in an array
If the locations of the peaks are indices into the independent and dependent variable vectors, then something like this shoud wo...

5 years ago | 0

Answered
plot show up empty
It is best to not use global variables. The ‘lic’ funciton should be: function xd=lic(t,x, YH, YA, fp, iXB, iXP, miuH, bH, ...

5 years ago | 0

| accepted

Answered
Application of filtfilt function
The filtfilt function filters in the time domain only. To see the result of the filtering, calculate the fft of the time-doma...

5 years ago | 0

| accepted

Answered
Temperature Contour Plot. Getting an error!
The problem are the data, not scatteredInterpolant. You can see that by plotting: figure stem3(x, y, T) There is no surfa...

5 years ago | 0

Answered
Use fzero but I have arrays
The fzero function is not appropriate here. Use interp1 instead: t = [0,500,1000,1500,2200,2900,3600,4300,5200,6500,7000,7500...

5 years ago | 1

| accepted

Answered
How to find unknown in the equation
Since ‘p’ is a vector, probably the easiest way to do this is to use a loop: for k = 1:numel(p) sol(k) = vpasolve(r.*(1+(...

5 years ago | 1

| accepted

Load more