Plot 2 function variables with exp and abs

I have to plot this 2 variables function: e^{-|(x,y)|}.
x = sym('x', [2 1]);
f = exp(-abs(x(1),x(2)));
fsurf(f)
set(gca, 'XLim', [-1 1], 'YLim', [-1 1], 'ZLim', [0 2]);
I'm using this code that work perfectly for others 2 variables function but now I have this error:
Error using sym/abs
Too many input arguments.
Error in (line 5)
f = exp(-abs(x(1),x(2)));
What can I do?

댓글 수: 3

Sam Chak
Sam Chak 2022년 3월 27일
편집: Sam Chak 2022년 3월 27일
What is ? Is it ?
No, it's (x,y). The function's plot is this one:
I've just solve the ploblem putting
f = exp(-sqrt(x(1)^2+x(2)^2));
instead of
f = exp(-abs(x(1),x(2)));

답변 (0개)

이 질문은 마감되었습니다.

제품

질문:

2022년 3월 27일

마감:

2022년 3월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by