I've found a MATLAB plot in a book and want to know which command the authors used for the plot

75 Views Asked by At

I'm reading a book where the authors write that

plot

is a MATLAB plot of the approximation obtained by the method of lines for the finite difference approximation of the Nagumo equation $$\frac{\partial u}{\partial t}u=\varepsilon\frac{\partial^2u}{\partial x^2}+u(1-u)(u-\alpha)$$ for $\varepsilon=1$ and $\alpha=1/2$ on $(0,1)$. The approximation is a set of vectors $u_{t_n}$ approximating $(u(t_n,x_1),\ldots,u(t_n,x_J))$ with $t_n=n\Delta t$.

Which MATLAB command did they use?

1

There are 1 best solutions below

4
On BEST ANSWER

If it's just the plot you're after then it might go something like this. Suppose that $M$ is a matrix containing the discrete values of your function, found on a finite differences grid. If you have times from $0$ to $10$ and $n$ steps on the horizontal axis then the code might look something like

[X,Y] = meshgrid(linspace(0,1,n),linspace(0,10,11));
surf(X,Y,M); view(2); shading interp; colormap gray;