how to plot this ?
古いコメントを表示
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
2020 年 10 月 21 日
syms x;
y=exp(-x).*sin(x);
fplot(x,y);
4 件のコメント
Tomer Segev
2020 年 10 月 21 日
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
2020 年 10 月 21 日
BTW: Did you notice that you can accept and/or vote for useful answers?
Tomer Segev
2020 年 10 月 21 日
カテゴリ
ヘルプ センター および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!