How to plot "f(x,y) = e^-(x^2+y^2)" function in matlab?

Undefined function or variable 'y'.
Error in Untitled (line 5)
y = exp(x.^2+y.^2);
my computer gives these errors and I do not know how to fix them.

2 commentaires

Torsten
Torsten le 9 Avr 2020
Try "surf".
Beyza Taka
Beyza Taka le 9 Avr 2020
That hasn’t changed

Connectez-vous pour commenter.

 Réponse acceptée

Star Strider
Star Strider le 9 Avr 2020
Modifié(e) : Torsten le 9 Avr 2020
Try this:
figure
fsurf(@(x,y)exp(-(x.^2+y.^2)), [-2 2 -2 2])

8 commentaires

Beyza Taka
Beyza Taka le 9 Avr 2020
A blank page opening., not a graphic.
Torsten
Torsten le 9 Avr 2020
Try again. I corrected a little typo.
I have no idea what the problem is.
I copied working code (that runs without error in R2020a) based on the posted ‘exp(x.^2+y.^2)’ expression:
figure
fsurf(@(x,y)exp(x.^2+y.^2), [-2 2 -2 2])
and produced the correct plot:
The function in the title:
figure
fsurf(@(x,y)exp(-(x.^2+y.^2)), [-2 2 -2 2])
produces:
again without error in R2020a.
Beyza Taka
Beyza Taka le 9 Avr 2020
Thank you very much.I guess I couldn't because my Matlab version was old.I tried it online in the 2020 version and the graphics came out.
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.
Nguyet Nguyen
Nguyet Nguyen le 13 Août 2022
Modifié(e) : Nguyet Nguyen le 13 Août 2022
Can you also suggest for me what range would i change if i want to draw the function f(x,y)=(x^(2)+y^(2)) ℯ^(y^(2)-x^(2))
Rik
Rik le 13 Août 2022
@Nguyet Nguyen You should have posted a link to your question. That way you avoid double effort.
Torsten
Torsten le 13 Août 2022
Can you also suggest for me what range would i change if i want to draw the function f(x,y)=(x^(2)+y^(2)) ℯ^(y^(2)-x^(2))
The proof of the pudding is in the eating.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by