how to plot a function?

1 回表示 (過去 30 日間)
Kit Coltamne
Kit Coltamne 2017 年 11 月 30 日
コメント済み: Star Strider 2017 年 11 月 30 日
Im trying to plot 'd' as a function of variable 'me' from 0 to 1200 but just get a straight line. Any suggestions? Thanks.
mc = 1000;
Sp = 4000;
Se = 400000;
Sc = 0.2;
eff = 0.6;
v = 13.41;
me = 0:1200;
d = ((Se*me*(Sp-(Sc*v)))/(Sc*Sp*(mc+me)))*eff;
plot(me,d,'x')

採用された回答

Star Strider
Star Strider 2017 年 11 月 30 日
You need to vectorise the division (use (./) instead of (/):
d = ((Se*me*(Sp-(Sc*v)))./(Sc*Sp*(mc+me)))*eff;
INSERT ‘.’ HERE
See Array vs. Matrix Operations (link) for details.
  2 件のコメント
Kit Coltamne
Kit Coltamne 2017 年 11 月 30 日
Perfect, thank you !!
Star Strider
Star Strider 2017 年 11 月 30 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by