i want to draw a graph
2 ビュー (過去 30 日間)
古いコメントを表示
i want to draw a graph on just command window.
f(x)=(exp(x).*sin(x)+(x./exp(x))
on 0<=x<=2*pi
but i got error! how i fix ?
>> f=@(x)(exp(x).*sin(x)+(x./exp(x))
x=linspace(0,2*pi,200);
error: parse error:
anonymous function bodies must be single expressions
>>> x=linspace(0,2*pi,200);
^
>>
0 件のコメント
採用された回答
Voss
2022 年 4 月 29 日
You are missing a close parenthesis
f=@(x)(exp(x).*sin(x)+(x./exp(x))
% ^ no matching close parenthesis for this
That open parenthesis is not necessary, so you can remove it:
f=@(x)exp(x).*sin(x)+(x./exp(x))
or add a close parenthesis on the end of the line:
f=@(x)(exp(x).*sin(x)+(x./exp(x)))
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Graphics Performance についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!