Graphing 3d in MATLAB

  • MATLAB
  • Thread starter Dell
  • Start date
  • #1
590
0

Main Question or Discussion Point

i am learning MATLAB, but have not yet learned anything do do with graphing, but need a program that can plot x.y.z graphs for my calculus work,

can someone please help me plot 3d graphs on MATLAB, for example

z=x2+2x+y2-y

how can i input x,y,z so that MATLAB will give me the surface graph of this function
 

Answers and Replies

  • #2
243
1
Modify as you need:

[X Y] = meshgrid(linspace(-10,10));
z=X.^2+2.*X+Y.^2-Y;
mesh(X,Y,z)

Alternatively use "surf" instead of "mesh".
 

Related Threads for: Graphing 3d in MATLAB

  • Last Post
Replies
0
Views
3K
  • Last Post
Replies
0
Views
5K
  • Last Post
Replies
1
Views
8K
  • Last Post
Replies
2
Views
3K
  • Last Post
Replies
6
Views
105K
  • Last Post
Replies
1
Views
2K
Replies
0
Views
3K
Top