# Plotting 3D graphs in Matlab

1. ## Plotting 3D graphs in Matlab

Hi there,

I looked up in the help but couldnt get a good example on how to plot a 3D curve in matlab.

I need to plot z =x^2+16*x*y^3 + 64*y^6 + 2*(x-2*xy-4)^4 how can I do this?

•

2. ## Re: Plotting 3D graphs in Matlab

>>xord=-2:.2:2;

>>yord=-2:.2:2;

>>[x,y]=meshgrid(xord,yord);

>>z=x.^2 + 16*x*y.^3 + 64*y.^6 + 2*(x-2*x*y-4).^4;

>>plot3(x,y,z);

1 members found this post helpful.

3. ## Re: Plotting 3D graphs in Matlab

surf(x,y,z) or surfc(x,y,z) may help

•

4. ## Re: Plotting 3D graphs in Matlab

surf and mesh functions works for you. If you use a sigle matrix as argument they plot z values on a 1:numrows (y axe) by 1:numcols (x axe). If you want to add specific x and y coordinates of each values you use surf(x,y,z) where x and y are 2 matrix x(n,m) and y(n,m) are the coordinates of z(n,m).

5. ## Re: Plotting 3D graphs in Matlab

its quite simple,

i use

plot3(x,y,z);
mesh.
surf.
waterfall.

and others

check the help on each of them

•

6. ## Re: Plotting 3D graphs in Matlab

hii... I m sauchon from Malaysia.
I want plot the
z=x.^2 + 16*x*y.^3 + 64*y.^6 + 2*(x-2*x*y-4).^4;
in MATLAB .
But, I want in z function in dynamic function .
How can i do this?
Any advice or suggestion of command can share with me?
Thx a lot....

7. ## Plotting 3D graphs in Matlab

@tohsauchon: What the meaning of Dynamic Function??, please explain the full detail, Hehehe..

I ussually use the symbolic variable for plotting function, cuz it run smoother, ..

syms x y z
z = x^2+16*x*y^3 + 64*y^6 + 2*(x-2*x*y-4)^4;
ezmesh(z)

you can also use the ezsurf(z), ..

--[[ ]]--