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

4 days 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...

5 days ago | 0

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

5 days ago | 0

| 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); ...

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

5 days ago | 0

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

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

6 days 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));

6 days 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...

6 days ago | 0

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

6 days ago | 0

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

6 days 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 ...

6 days 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...

6 days ago | 0

| 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 days 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 days ago | 0

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 days 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 days 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 days 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 days 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 days ago | 0

| 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 days 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 days ago | 0

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

8 days 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...

8 days 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= %....

8 days ago | 0

Answered
How do i find the amplitude of a peak in my plot?
‘I want to find the peak with the most height(not the maximum y value, but the distance from the local minima just before the pe...

8 days ago | 0

Answered
fprintf in a for loop
I would do something like this: N = 12; k = 2; for i = 1:N-1 w(i) = k^i; w(i) end fid = fopen('Test2.txt', 'w');...

8 days ago | 0

| accepted

Answered
P values of fitting constants using FMINCON function
If you have fmincon, then you also have lsqcurvefit. Assuming you have constraints that lsqcurvefit can accommodate, use it to ...

8 days ago | 0

Answered
Is there a way to find the exact roots of a fitted function?
It would appear to be relatively straightforward. Since the function is 0 at: c*x + d = 0 and ‘a’ appears to be 0 or close...

8 days ago | 0

Answered
Graphing does not appear
The plot will appear if you subscript ‘Bf’: for i=1:numel(t) %There are 216 months in 18 years, incrementing by 1 so per month...

8 days ago | 0

Load more