Answered
Error in stiff ode plot
You omitted an operator (that you likely intend to be a multiplication operator) ... dxdt(4)=x(3)*pe*(1-exp(hv(x(5)+x(1))))-de...

7 years ago | 0

| accepted

Answered
read certain range in csv file and save to new file
A loop is the only (and likely the simplest) option, since you need the zero values on both ends of each sub-vector: V = [0 ...

7 years ago | 0

| accepted

Answered
What is the equivalent of "extractBetween" function in MATLAB R2013a?
The extractBetween function deals primarily with string (link) variables, introduced in R2016b. The closest approximation in ...

7 years ago | 1

Answered
Index exceeds array bounds error
Consider: ‘n=100’ ‘dnew is a 100x1 matrix’ and you are addressing: dnew(i+1) that does not exist. Try this instead: ...

7 years ago | 0

| accepted

Answered
I need to reverse the X axis in a stacked plot graph. How can I do that?
That is not one of the options for the stackedplot function, although it is easy enough to do in code: x = linspace(0, 1); ...

7 years ago | 0

| accepted

Answered
how can we calculate interpolation between two double MATLAB arrays?
It depends on how you want to interpolate them. The‘safest’ way is likely to interpolate the longer vector to the length of the...

7 years ago | 0

| accepted

Answered
Changing Axes direction with positive z-axis downwards
If you only want to reverse the direcrtion of the z-axis, try this (after the surf call): set(gca, 'ZDir','reverse') The othe...

7 years ago | 2

Answered
Color background between two ylines patch (datetime)
The error is: Error using patch Non-numeric data is not supported in 'patch' So you can’t use it with datetime objects. I...

7 years ago | 3

| accepted

Answered
State Space modelling from an ODE
The easiest way is to let the Symbolic Math Toolbox do the heavy lifting: syms y(t) u(t) t Dy = diff(y); D2y = diff(y,2); ...

7 years ago | 2

| accepted

Answered
Splitting Cell Arrays by Delimiter
Try this: s = {'qwerty,uiop'; 'asdf,ghjkl,zxcvb'}; for k1 = 1:size(s,1) r(k1) = numel(strsplit(s{k1}, ',')); end Out = r ...

7 years ago | 0

| accepted

Answered
Error bars in loglog plot
You appear to have ‘x_u’ and ‘x_l’ reversed. Try this: x_u = 3.2000e-12; x_m = 2.7111e-12; x_l = 2.2222e-12; y_u = 1.825...

7 years ago | 0

| accepted

Answered
lsqcurvefit error - Matrix dimensions must agree
I can’t run your code. However, some things are immediately obvious: (1) you are not integrating ‘myode’ inside ‘DiffEqSolver...

7 years ago | 1

Answered
convert two columns( one real number and the other is imaginary but without (i) symbol) in txt file to complex number and one column.
Try this: D = xlsread('New Microsoft Excel Worksheet.xlsx'); Cplx = complex(D(:,1),D(:,2));

7 years ago | 0

| accepted

Answered
How to find the numerical partial derivative of matrix
See if the gradient (link) function will do what you want. You will probably have to experiment with it, since I do not under...

7 years ago | 0

| accepted

Answered
need to do a string interpolation
‘How can I write logic that would access a matrix but change the last character after each iteration.’ No need. I would conc...

7 years ago | 0

Answered
How can I bin Data
There are probalby several ways. One approach: x = randi(90, 90, 1); % Create Data y = r...

7 years ago | 0

Answered
numerical integration and solving for limit
You have told us nothing about ‘g(x)’. Assuming the integral of ‘g(x)’ is monotonically increasing at least until its integral ...

7 years ago | 1

| accepted

Answered
How can I draw the slope of the given values ​​on the chart?
I would use the gradient function rather than diff for this, since gradient produces a numerical derivative the same size as the...

7 years ago | 1

| accepted

Answered
how i can... meshgrid in matlab
Try this: xv = linspace(-1, 1, 20); [x1,x2] = meshgrid(xv); y = 35.5 + 10.5*x1 + 5.5*x2 + 8*x1.*x2; figure mesh(x1, x2, ...

7 years ago | 0

| accepted

Answered
Cylinder with top code
Those lines create flat upper and lower surfaces. The upper and lower surfaces otherwise would appear conical. The easiest w...

7 years ago | 0

| accepted

Answered
Fit a curve so that a part of it is the same as another curve
I am not certain what you want to do. The two functions that are most likely to give you the desired resultl are linspace (link...

7 years ago | 0

| accepted

Answered
Switching scales on x axis
See if: set(gca, 'XDir','reverse') does what you want. That will reverse the x-axis direction, and the data associated with ...

7 years ago | 1

| accepted

Answered
Fsolve initial condition accuracy
Nonlinear solvers of all sorts (fsolve, lsqcurvefit, etc.) are very sensitive to the initial estimates, since they will search f...

7 years ago | 1

Answered
HOW to draw the type of graph in matlab
Try this approach, using ‘logical indexing’: k = 0.1; f = @(x) k*((0 < x) & (x < pi)); x = linspace(-pi/2, 3*pi/2); fig...

7 years ago | 1

Answered
How do I make surface plots with many NaN's in my matrix?
The fillmissing (link) function may be what you want. See specifically Matrix with Missing Endpoints (link).

7 years ago | 2

| accepted

Answered
Can the amplitude be plotted in dB?
Try this: semilogx(Fv, 20*log10(abs(FT_af(Iv,2))*2)), xlabel('Frequency, Hz'),ylabel('magnitude'); That will convert the ampl...

7 years ago | 1

| accepted

Answered
'Array indices should be positive' error
This is the reason: std=std(col); You ‘overshadowed’ the std function by naming your variable ‘std’. Do this and the probl...

7 years ago | 1

| accepted

Answered
How can I add a comment on a curve ?
You could use an annotation (link) object (that I find difficult to use because of the coordinate system they require), or you c...

7 years ago | 0

| accepted

Answered
how can i change x to (x+h)?
I am not certain what problem you are having. You have to define all the values you pass to your function as arguments before c...

7 years ago | 0

| accepted

Answered
function parameter includes h. I want plot title to include same h. how to do?
I have no idea what ‘h’ is, although I assume it’s a number. Try this: title(sprintf('Approximate and Exact Solution @h= %....

7 years ago | 0

Load more