---
+ Post New Thread
Results 1 to 7 of 7
  1. #1
    Full Member level 4
    Points: 2,906, Level: 12

    Join Date
    Aug 2005
    Location
    Salvador-BA-Brazil
    Posts
    226
    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?

    •   Alt20th November 2006, 14:47

      advertising

        
       

  2. #2
    Advanced Member level 1
    Points: 3,604, Level: 14

    Join Date
    Apr 2004
    Posts
    471
    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.

    •   Alt20th November 2006, 15:56

      advertising

        
       

  3. #3
    Newbie level 3
    Points: 1,061, Level: 7

    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



    •   Alt27th January 2007, 06:48

      advertising

        
       

  4. #4
    Newbie level 1
    Points: 990, Level: 7

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



  5. #5
    Full Member level 2
    Points: 1,946, Level: 10
    mehboob_iiui's Avatar
    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



  6. #6
    Newbie level 2
    Points: 488, Level: 4

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



  7. #7
    Newbie level 3
    Points: 488, Level: 4

    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