hi..Im new in matlab programming. Can someone help me plot 3D graph of y=x-x^2, where z is form negative infinity to infinity.
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
x=linspace(-0.5,0.5);
y=linspace(-0.5,0.5);
y=x-x.^2;
plot(x,y)
i have done this,but how to plot it into 3D where it will be plane?
3 Commenti
Ameer Hamza
il 26 Giu 2018
What is z in your equation? What is your idea of plotting to infinity on a finite plane?
Risposte (1)
Ameer Hamza
il 26 Giu 2018
If you want to plot something the 3d surface plot of this equation
z = y - x + x^2
then try
x = linspace(-0.5, 0.5);
y = linspace(-0.5, 0.5);
[X, Y] = meshgrid(x, y);
Z = Y - X + X.^2;
mesh(X,Y,Z)

2 Commenti
Ameer Hamza
il 26 Giu 2018
If you just want to extend the 2D shape in third dimension then use
x = linspace(-0.5, 0.5);
z = -10:10;
[X, Z] = meshgrid(x, z);
Y = X - X.^2;
surf(X, Y, Z)
Vedere anche
Categorie
Scopri di più su 2-D and 3-D Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!