Answered
How can I solve this ODE 1000 times with random variables?
You coded your differential equation correctly. Your ‘x’ variable has only two elements, so you cannot use ‘n’ (or ‘k’) to subs...

7 years ago | 1

| accepted

Answered
How can I have a start and end date on the x-axis without having labels or ticks inbetween?
Without your data (and code) I can’t write code specifically for your problem. That aside, this should get you started: x =...

7 years ago | 2

Answered
Averaging Every nth column but the interval is different every time?
If your data do not have uniform ranges, a loop is likely the only option: V = [ones(4,1)+rand(4,1)/50; ones(6,1)*4+rand(6,1)/...

7 years ago | 0

Answered
how can i change color of a 3D plot?
I am not certain what you want. You can always experiment with the ‘CMap’ property: [X,Y] = ndgrid((0:0.1:1)); Z1 = X/10 -...

7 years ago | 1

| accepted

Answered
how can I do PCA on a table ?
The pca function only accepts single-precision or double-precision numerical arrays. You most likely need to use the table2arra...

7 years ago | 2

| accepted

Answered
Why i cant solve the 3 odes
Your ODE system is apparently ‘stiff’. If you change the solver to ode15s: %% Declaration of the weight span and the initial ...

7 years ago | 0

Answered
Why can't I use the ode45 function?
The function you posted is called ‘step’, not ‘step2’. (The ’step’ function is the name of several built-in MATLAB functions. ...

7 years ago | 0

Answered
compare the elements of multiple matrix and return min and max matrix
First concatenate them, then do the min and max calls: ABC = cat(3,A,B,C); Min = min(ABC,[],3) Max= max(ABC,[],3) producing...

7 years ago | 2

| accepted

Answered
Double integral of numerical data
‘... how can I use trapz as double integral?’ If your x, y, and P vectors represent an area in 2D, they may be gridded. You ...

7 years ago | 0

| accepted

Answered
Problem with integral() function
Your post lacks details. However, Iit seems that ‘x’ is a vector. It is not possible to assign a vector to a scalar array elem...

7 years ago | 1

Answered
Graphing inequalities to show common region
One option is to use the patch (link) function: x = linspace(-1.5, 1.5); % Row Vector y1 = x; ...

7 years ago | 0

| accepted

Answered
Using DSB-SC for a wav file.
If you intend to create a double sideband -suppressed carrier signal, you need to use element-wise multiplication: m = data .*...

7 years ago | 1

| accepted

Answered
merging vectors together with alternating values
Try this: A=[1; 2; 3; 4]; B=[5; 6; 7; 8]; C = [A(:) B(:)]'; C = C(:) producing: C = 1 5 2 6 ...

7 years ago | 2

Answered
How to report linear regression results?
If you are doing this for a journal paper submission, consult the journal style guide. As a general rule, the t-statistics ar...

7 years ago | 1

| accepted

Answered
is there a way to obtain peak width after peak detection ?
Not a stupid question at all. You simply need to ask findpeaks to return them as outputs: [pks,locs,widths,proms] = findpea...

7 years ago | 0

| accepted

Answered
Calculate area under graph between two points
Try this: x = linspace(0, 5*pi); % Create Data y = sin(x); ...

7 years ago | 0

Answered
Applying bandstop filter to multiple files
I am not certain if you want a bandpass (link) or bandstop (link) filter. (These functions are in R2018a and later releases.) ...

7 years ago | 1

| accepted

Answered
Solve equation f(x) = sin(x) − x^2 = 0 providing x is not equal 0 solution.
Plot it first. That will give you an idea of how best to search for at least one non-trivial solution: f = @(x) sin(x) - x.^2...

7 years ago | 0

| accepted

Answered
compare two matrices or vectors that have the same numbers but in different order
The easiest way is to sort them across rows: A = [1 2 3 4 5 6 7 8 9]; B = [2 3 1 4 6 5 8 9 7]; L = a...

7 years ago | 0

| accepted

Answered
How to store vectors of unequal sizes, created by a for loop in a cell?
I would just do something like this: SK_BL_Cell{k} = SK_BL(:,k); F_out_BL_Cell{k} = F_out_BL(:,k); Thresh_BL_Cell{k} = Thres...

7 years ago | 1

| accepted

Answered
Derivative after Numerical Integral
Try this: dfdx = @(f,x) (f(x + 1E-8) - f(x)) ./ 1E-8; % Simple Numeric Derivative a = @(x...

7 years ago | 1

| accepted

Answered
Time dependent variables in differential equation
See the documentation section on: ODE with Time-Dependent Terms

7 years ago | 0

Answered
Calculate area of piecewise closed curve
Experiment with the polyarea function.

7 years ago | 0

Answered
Plot functions and intersections
The fsurf function takes two arguments: figure fsurf(fun1) hold on fsurf(fun2) fsurf(fun3) fsurf(fun4) hold off althoug...

7 years ago | 0

Answered
Integral2 With Spherical Harmonics
I can’t run your code because I don’t have all the variables. The probllem is a typographical error in ‘func’. Try this in...

7 years ago | 0

| accepted

Answered
How to convert a string to symbolic equation?
If you have R2017b or later, you can use the str2sym function.

7 years ago | 0

Answered
How to Plot Phase and Frequency reponse from a WAV-File?
If you have the input as one channel and the output as another, just do a fft on each. Divide the fft of the output by the fft ...

7 years ago | 0

Answered
how to plot x-axis only
This comes close: figure xlim([-4.2 4.2]) plot((rand(1,20)-0.5)*3, zeros(1,20), '+r') text(min(xlim), 0.025, '\leftarrow', ...

7 years ago | 0

| accepted

Answered
How do I solve this System of equations
If you have the Optimization Toolbox, you can use fsolve: % % % b = [hcond ms Qs Qcond] A = @(b) [b(3)-b(4)-7500; b(3)-2777*...

7 years ago | 0

Answered
Why the underscore is red?
That usually means that the underscore you are using is not part of the ASCII character set MATLAB recognises. The correct un...

7 years ago | 0

Load more