How can i plot this 3D function?
31 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Francesco Bellora
el 9 de Oct. de 2020
Comentada: Francesco Bellora
el 9 de Oct. de 2020
Hi, im trying to plot
f(x,y)= e^(x-y) +x^2 +y^2
but in every way i try to plot it it returns the wrong graph (it should be a paraboloid). This is the code im using:
[X,Y]= meshgrid(-10:10);
Z= exp(X-Y) + X.^2 + Y.^2;
surf(X,Y,Z)
Thank you for your help!
0 comentarios
Respuesta aceptada
Ameer Hamza
el 9 de Oct. de 2020
Paraboloid is Z = X.^2 + Y.^2;
[X,Y]= meshgrid(-10:10);
Z = X.^2 + Y.^2;
surf(X,Y,Z)
Due to exp() term in your equation, you won't necessarily get a paraboloid.
3 comentarios
Ameer Hamza
el 9 de Oct. de 2020
Yes, the graph generated by GeoGebra has a very small range of z-axis. The following code changes the range.
[X,Y]= meshgrid(linspace(-2,2));
Z = exp(X-Y) + X.^2 + Y.^2;
surf(X,Y,Z)
xlim([-5 5])
ylim([-5 5])
zlim([-1 7])
shading interp
Más respuestas (0)
Ver también
Categorías
Más información sobre Two y-axis en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
