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

Stephen23
Stephen23 2015년 6월 24일
Why do you need an anonymous function?
This is not required for plotting.

댓글을 달려면 로그인하십시오.

답변 (2개)

Guillaume
Guillaume 2015년 6월 24일
편집: Guillaume 2015년 6월 24일

0 개 추천

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 2015년 6월 24일

0 개 추천

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

카테고리

도움말 센터File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

질문:

2015년 6월 24일

댓글:

2015년 6월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by