how to create an anonymous function?

f(x,y)=x exp(-2y^2-x^2)
plot the surface of the function over R=[-2,2] x [-2,2]

1 Kommentar

Stephen23
Stephen23 am 24 Jun. 2015
Why do you need an anonymous function?
This is not required for plotting.

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Guillaume
Guillaume am 24 Jun. 2015
Bearbeitet: Guillaume am 24 Jun. 2015

0 Stimmen

Aren't the example in the documentation clear enough?
In this case (assuming the missing operator between x and exp is a multiplication):
f = @(x, y) x.*exp(-2*y.^2-x.^2);
Note: this is an answer to your question title: "How to create an anonymous function".
Azzi Abdelmalek
Azzi Abdelmalek am 24 Jun. 2015

0 Stimmen

x=[-2,2]
y=[-2,2]
[X,Y]=meshgrid(x,y)
Z=X.*exp(-2*Y.^2-X.^2)
surf(X,Y,Z)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 24 Jun. 2015

Kommentiert:

am 24 Jun. 2015

Community Treasure Hunt

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

Start Hunting!

Translated by