Plotting 3D graphs in Matlab

Status
Not open for further replies.

claudiocamera

Full Member level 4
Joined
Aug 19, 2005
Messages
224
Helped
27
Reputation
54
Reaction score
6
Trophy points
1,298
Location
Salvador-BA-Brazil
Activity points
4,282
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?
 

>>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);
 
surf(x,y,z) or surfc(x,y,z) may help
 

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

its quite simple,

i use

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

and others

check the help on each of them
 

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

@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), ..
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…