+ Post New Thread

Results 1 to 7 of 7

- 20th November 2006, 14:47 #1

- Join Date
- Aug 2005
- Location
- Salvador-BA-Brazil
- Posts
- 225
- Helped
- 28 / 28
- Points
- 2,906
- Level
- 12

## 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?

- 20th November 2006, 14:47

- 20th November 2006, 15:56 #2

- Join Date
- Apr 2004
- Posts
- 467
- Helped
- 23 / 23
- Points
- 3,604
- Level
- 14

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

- 27th January 2007, 06:48 #3

- Join Date
- Jan 2007
- Posts
- 3
- Helped
- 0 / 0
- Points
- 1,061
- Level
- 7

## Re: Plotting 3D graphs in Matlab

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

- 27th January 2007, 06:48

- 13th June 2007, 12:45 #4

- Join Date
- Jun 2007
- Posts
- 1
- Helped
- 0 / 0
- Points
- 990
- Level
- 7

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

- 4th July 2007, 16:54 #5

- Join Date
- May 2006
- Location
- Rawalpindi - Pakistan
- Posts
- 132
- Helped
- 8 / 8
- Points
- 1,946
- Level
- 10

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

- 4th July 2007, 16:54

- 1st April 2010, 22:58 #6

- Join Date
- Mar 2010
- Location
- Malaysia
- Posts
- 2
- Helped
- 0 / 0
- Points
- 488
- Level
- 4

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

- 5th April 2010, 16:24 #7

- Join Date
- Apr 2010
- Location
- Indonesia
- Posts
- 4
- Helped
- 0 / 0
- Points
- 488
- Level
- 4

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

+ Post New Thread

Please login