Answered
How to add a legend to a graph with multiple lines
You need to set ‘alpha’ as a separate vector, then use compose or the undocumented function sprintfc to create the legend string...

8 years ago | 0

Answered
How to use use a butterworth narrow passband filter signal on work window
This is likely impossible. No filter that I am aware of will be able to define such a narrow passband at such a high sampling r...

8 years ago | 0

Answered
Convert each cell using datetime
Try this: t = {'0.0039583' '0.015058' '0.0091898' '0.012731' '0.00061343' '0.015799' '0.0022917' '0.036933' '0.018819' '0.0026...

8 years ago | 0

| accepted

Answered
Undefined function 'offsetstrel' for input arguments of type 'char'.
‘the toolbox is installed but i don't know why it still giving that error. ¹ You may have a corrupted path. Run these from...

8 years ago | 0

| accepted

Answered
Can't plot a trendline
I can’t see that you invited the trendline to appear. See the documentation on lsline (link) to invite it to participate.

8 years ago | 0

Answered
Errors for the slope and intercept
Consider the File Exchange contribution polyparci (link).

8 years ago | 0

Answered
diff eq, plotting several trajectories of a system of differential equations. what is wrong with the code
It’s likely easier to create the differential equaitons as an anonymous function, then integrate them with one of the numerical ...

8 years ago | 0

Answered
how to plot a Patch variable type
You have to re-plot it with a second patch call: x = linspace(-1, 1); y1 = 1.5*x.^2+1; y2 = x.^2 + 1.5; figure(1) patchV...

8 years ago | 0

Answered
how can i find the standard deviation of one column within a matrix?
Try this: stdevCol2 = std(YourMatrix(:,2))

8 years ago | 0

Answered
how to install glmnet package in Matlab?
I have not used it. However, it can be downloaded as glmnet_matlab.zip so you most likely need to unzip it to a sub-directory o...

8 years ago | 0

| accepted

Answered
Numerical integral of sin(x)/x from 0 to inf
One option is to use a large upper limit that is less than Inf: z = integral(@(x) sin(x)./x, 0, 1E+4) z = 1.570891...

8 years ago | 0

| accepted

Answered
Error regarding not enough input arguments
How did you call your ‘sinusoid’ function? You must provide ‘sinmusoid_type’ and the other arguments. Your function will not...

8 years ago | 0

Answered
I've got this question to do for an assignment but I have no clue where to start or how to set it out, much help would be useful, like a template of how to answer it
Read the documentation on: load numel or length inputdlg gt, lt, eq plot legend That will get you started. If you hav...

8 years ago | 0

Answered
Is it possibel to use more than one option in fminsearch?
Here is an example: f = @(x) (x+2).^2 - 1; options = optimset('MaxIter',1E+5, 'MaxFunEvals',1E+4); xfmin = fminsearch(f, 1...

8 years ago | 0

Answered
how can I create a matrix of zeros and ones with dimension 2^n*n?
Try this: Out = dec2bin(0:(2^M)-1)-'0' produces: Out = 0 0 0 0 0 1 0 1 0 0 ...

8 years ago | 0

| accepted

Answered
How to plot sawtooth wave sawtooth function?
You are very close. Try this: f = @(x) rem(x+3,2)-1 figure fplot(f, [-3,3]) It offsets the ‘x’ value, subtracts 1 so the...

8 years ago | 0

| accepted

Answered
How to make a matrix mirror another?
Try this: a = 42; X=[4 7 1 0; 3 0 6 8] Y=[32 6 4 21; 77 89 0 2] Idx = X==0 X(Idx) = a Y(Idx) = a ...

8 years ago | 1

| accepted

Answered
The final B matrix should be a zero matrix but i'm getting very small values in it, despite the code being correct; please help.
You are seeing the cumulative results of floating-point approximation error. See the documentation section on Accuracy of Flo...

8 years ago | 0

| accepted

Answered
How to solve a differential equations?
syms t y(t) a = diff(y) == t.*y+t.^2.*sin(t); av = odeToVectorField(a) a_fcn = matlabFunction(av, 'Vars',{t,Y}) You can then...

8 years ago | 0

Answered
How do I extract values from fitting my custom equation to a data set with multiple data entries?
I am using this code to estimate your parameters: Vd = xlsread('W1umL3um.xlsx', 'C4:C53'); Id0 = xlsread('W1umL3um.xlsx', 'D5...

8 years ago | 0

Answered
How to sort a data set for plotting
Ise the second output of the sort function to return the indices, then use those to map ‘TPF’: TNF = ['e', 'a', 'd', 'c', 'b...

8 years ago | 1

| accepted

Answered
how can ı filter high pass filer ?
If you have R2018a or later use the highpass (link) funciton. It returns an efficient elliptical filter. If you use the ‘d’ (d...

8 years ago | 0

| accepted

Answered
Solve a system of equations having variables as a arrays
You need to define ‘x’ as a vector uisng the sym function. Then it works: syms x x = sym('x',[1 2]); ...

8 years ago | 0

| accepted

Answered
How can I plot a square wave in Matlab
Try this: f = 5; % Frequency N = 16; ...

8 years ago | 0

| accepted

Answered
How to make a bandpass filter to only let 1-2 Hz of our signal pass?
If you have R2018a or later, use the bandpass (link) function. It designs an efficient elliptical filter. If you use the sec...

8 years ago | 0

Answered
How to mark my data on the graph that I've made with curve fitting?
Choose whatever colours, lines, and markers you want. Here, I chose green pentagrams, connected by dashed green lines: x=[0,0...

8 years ago | 0

| accepted

Answered
I keep getting this error: The following error occurred converting from sym to double: Unable to convert expression into double array. It happens at line 15. How do I fix this?
When I ran your code, I got an error for a nonexistent ‘t2’. When I changed it to ‘t2M’, it ran without error: t = t2(1,k); ...

8 years ago | 0

Answered
How to create a vector of this output?
Try this: [X,Y,Z] = ndgrid(-2:2); Out = [Z(:),Y(:),X(:)] producing: Out = -2 -2 -2 -2 -2 -1 -2 ...

8 years ago | 0

| accepted

Answered
How can I make this find function in a for loop run faster using vectorization?
Try this: zci = @(v) find(v(:).*circshift(v(:), [-1 0]) <= 0); % Returns Approximate Zero-Crossing Indices ...

8 years ago | 0

| accepted

Answered
How can I label a vector?
Try this: L = [ones(1,5) zeros(1,5)]; % Labels V = rand(1,10); % Vector ...

8 years ago | 0

| accepted

Load more