Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

How to make 3D plot in matlab

  1. Oct 23, 2011 #1
    Dear Friends

    I have made 2D plot in matlab and want to convert it in 3D can you give me any suggestions please.

    if
    s=x^2+y^3
    x=linspace(0,2);
    plot(y,s,'b')
    this gives the plot of 2D
    I want to make it in 3D for any value of z axis(-1 to 1)
    what changes i have to do ??????
     
  2. jcsd
  3. Oct 23, 2011 #2

    Dr Transport

    User Avatar
    Science Advisor
    Gold Member

    plot3 is the function you want, set the z component equal to the value you want.
     
  4. Oct 24, 2011 #3
    not formed ,,,hmmmm
    the case is,,, I have equation of two variables,,
    simply
    x=linspace(0,1)
    y=x^2
    plot(x,y,'b')
    now I want to convert this parabolic in 3D
    x=linspace(0,1)
    z=-1:0.1:1;
    y=x^2
    plot3(x,y,z)
    but not working it gives
    ??? Error using ==> mpower
    Matrix must be square.
     
  5. Oct 24, 2011 #4
    I tried what you said for different example work but I need graph as in attachment,
     

    Attached Files:

    • Doc1.doc
      Doc1.doc
      File size:
      26.5 KB
      Views:
      123
    Last edited: Oct 24, 2011
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: How to make 3D plot in matlab
  1. 3D plot using Matlab (Replies: 1)

  2. MATLAB, 3D plotting (Replies: 1)

Loading...