syms x;
y=exp(-x).*sin(x);
plot(x,y);
hey, i want to plot this but for reaon I can't.. I didn't find any answer in previous questions.
can someone tell me where I am wrong ?

답변 (1개)

Stephan
Stephan 2020년 10월 21일

1 개 추천

syms x;
y=exp(-x).*sin(x);
fplot(x,y);

댓글 수: 4

Tomer Segev
Tomer Segev 2020년 10월 21일
why are you using the fplot ?
Stephan
Stephan 2020년 10월 21일
fplot plots expressions or functions - this is what you have done here. To use plot, you would need to have vectors containing values to plot. For example:
fun = @(x) exp(-x).*sin(x);
fplot(fun)
works - but
fun = @(x) exp(-x).*sin(x);
plot(y)
gives an error. If you calculate values from the function, it will work using plot:
fun = @(x) exp(-x).*sin(x);
x = linspace(-5,5);
y = fun(x);
plot(x,y)
This is the difference in both commands.
Stephan
Stephan 2020년 10월 21일
BTW: Did you notice that you can accept and/or vote for useful answers?
Tomer Segev
Tomer Segev 2020년 10월 21일
OK, that's great! thank you!

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

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

태그

질문:

2020년 10월 21일

댓글:

2020년 10월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by