MatLab plot part of surface

Posted by Kristian on Stack Overflow See other posts from Stack Overflow or by Kristian
Published on 2012-06-01T19:32:59Z Indexed on 2012/06/02 4:41 UTC
Read the original article Hit count: 133

Filed under:
|

Say I have the following script:

u = -5:.2:5;
[X,Y] = meshgrid(u, u);
Z = cos(X).*cos(Y).*exp(-sqrt(X.^2 + Y.^2)/4);
surf(X,Y,Z);

Is there anyway that I can make MatLab plot only parts of the surface? Say, for instance, I just want to plot a single point, or a single grid, what can I do? I thought perhaps to plot a single point I could use:

surf(X(1,1), Y(1,1), Z(1,1))

But then I get the error message:

??? Error using ==> surf at 78
Data dimensions must agree.

I would really appreciate some input/help here. Thanks in advance :)

© Stack Overflow or respective owner

Related posts about matlab

Related posts about plot