Plotting 3D functions
Mostrar comentarios más antiguos
Given: Create both a contour and surface plot for the following function.
Find:
- Create an x vector between -2 and 2, with a step size of .2
- Create a y vector between -2 and 2, with a step size of .2
- Create a matrix X and Y that contains a grid of coordinate pairs from x and y
- Create a matrix Z that is the same size as X and Y
Create the following plots, with labels
- Contour plot
- Surface plot
Issue: I have what I believe to be the correct code, however, it's giving me an error stating not enough input arguments...
My Solution: What am I missing here?
x=-2:0.2:2
y=x
[X,Y]=meshgrid(x,y)
Z=x.*exp.^-(x.^2+y.^2)
contour(X,Y,Z)
surf(X,Y,Z)
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Labels and Annotations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

