HOW DO I PLOT THIS GRAPH

Create a surface plot of the following function: Z = (4x^2+y^2+x-1)e^(-x^2-y^2)
the function z has 2 maximum points and 1 minimum point. Make sure your graph shows these 3 points clearly.

8 Kommentare

Zeng Zhi Tee
Zeng Zhi Tee am 2 Sep. 2018
but there is error
Zeng Zhi Tee
Zeng Zhi Tee am 2 Sep. 2018
@Walter Roberson can help me to write down the code?
Zeng Zhi Tee
Zeng Zhi Tee am 2 Sep. 2018
who can help me!!
Walter Roberson
Walter Roberson am 2 Sep. 2018
That other question already has most of the code. The rest you should develop on your own, following the direction I gave there. If you have specific questions about error messages or what the MATLAB function name is to do a particular operation, then you should ask about that.
KALYAN ACHARJYA
KALYAN ACHARJYA am 2 Sep. 2018
@Zeng Already Walter sir gave you the sufficient answer, now onwards learn by doing, not too much depends on "No learning just question posting".
Zeng Zhi Tee
Zeng Zhi Tee am 9 Sep. 2018
Bearbeitet: Walter Roberson am 9 Sep. 2018
This Correct?
[x,y]=meshgrid(-2:0.1:2,0:1);
z = (4.*x.^2 + y.^2 + x - 1).*exp((-x.^2) - (y.^2));
surf(x,y,z)
That looks okay.
I tend to suggest
surf(x, y, z, 'edgecolor', 'none')
to prevent the black edges from being drawn. The black edges are constant thickness, and can easily hide the graph itself when you plot more densely.
Notice by the way that you are only using two distinct points in y, since 0:1 is the same as [0 1] . Perhaps you were thinking of something like 0:.1:1

Antworten (0)

Diese Frage ist geschlossen.

Gefragt:

am 2 Sep. 2018

Geschlossen:

am 20 Aug. 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by