Results 1 to 5 of 5

Math Help - 3D plot of z = (Matlab)

  1. #1
    Member
    Joined
    Apr 2010
    Posts
    156

    3D plot of z = (Matlab)

    I tried drawing an elliptic paraboloid ( z = x^2 + y^2) in Matlab with the following code:

    >> [x y] = meshgrid(0 : 5);
    >> z = x.^2 + y.^2;
    >> surf(z);

    However the surface which it produced does not look like an elliptic paraboloid (please refer to the attachment).
    Attached Thumbnails Attached Thumbnails 3D plot of z = (Matlab)-z-x-2-y-2.jpg  
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Junior Member
    Joined
    Jun 2011
    Posts
    56

    Re: 3D plot of z = (Matlab)

    Quote Originally Posted by SyNtHeSiS View Post
    However the surface which it produced does not look like an elliptic paraboloid (please refer to the attachment).
    It does show an elliptic paraboloid. However you've only plotted a single quadrant of it. Create a meshgrid that spans from -5 to 5 and you'll get the picture that you're looking for.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Member
    Joined
    Apr 2010
    Posts
    156

    Re: 3D plot of z = x^2 + y^2 (Matlab)

    Thanks. Why is it that the elliptic paraboloid in Matlab is different to the standard one? (please refer to the attachments).
    Attached Thumbnails Attached Thumbnails 3D plot of z = (Matlab)-matlab.jpg   3D plot of z = (Matlab)-standard_elliptic_paraboloid.jpg  
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Junior Member
    Joined
    Jun 2011
    Posts
    56

    Re: 3D plot of z = x^2 + y^2 (Matlab)

    Quote Originally Posted by SyNtHeSiS View Post
    Thanks. Why is it that the elliptic paraboloid in Matlab is different to the standard one? (please refer to the attachments).
    Could you elaborate? Which difference do you mean?
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4

    Re: 3D plot of z = x^2 + y^2 (Matlab)

    Quote Originally Posted by corsica View Post
    Could you elaborate? Which difference do you mean?
    I think he is petrubed by the square in the x-y plane that the surface is plotted above giving the plotted part of the surface peaks at the corners rather than the circular form of the top edge of the plotted part of the surface in the second plot.

    try something like:

    Code:
    >> [r,the]=meshgrid([0:0.1:5],[0:pi/10:2*pi]);
    >> x=r.*cos(the);
    >> y=r.*sin(the);
    >> z=x.^2+y.^2;
    >> surf(x,y,z);
    CB
    Last edited by CaptainBlack; July 14th 2011 at 09:58 PM.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. loglog plot in MATLAB
    Posted in the Math Software Forum
    Replies: 2
    Last Post: March 31st 2011, 08:43 PM
  2. Kac Formula plot with MatLab
    Posted in the Math Software Forum
    Replies: 1
    Last Post: March 14th 2010, 08:33 AM
  3. help me to plot this equation in Matlab....
    Posted in the Math Software Forum
    Replies: 1
    Last Post: April 23rd 2009, 10:38 PM
  4. [Matlab] 2D Sequence Plot in 3D
    Posted in the Math Software Forum
    Replies: 2
    Last Post: April 23rd 2009, 05:28 AM
  5. MatLab Plot
    Posted in the Math Software Forum
    Replies: 1
    Last Post: August 2nd 2008, 11:59 AM

Search Tags


/mathhelpforum @mathhelpforum