How Can I Convert a 2D Plot to a 3D Plot in MATLAB?

  • Context: MATLAB 
  • Thread starter Thread starter adnan jahan
  • Start date Start date
  • Tags Tags
    3d Matlab Plot
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
3 replies · 5K views
adnan jahan
Messages
93
Reaction score
0
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 ?
 
Physics news on Phys.org
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.
 
I tried what you said for different example work but I need graph as in attachment,
 

Attachments

Last edited: