フィルターのクリア

How do I plot a function of one variable easily in matlab?

16 ビュー (過去 30 日間)
Russell
Russell 2015 年 2 月 19 日
コメント済み: Star Strider 2015 年 2 月 19 日
This is such a simple thing, I know, I'm just really struggling making it work at all well. I think it's a problem with how I've written the function, something about the element-wise operations. Here's my code:
figure
y = linspace(0,20,0.5);
f = r*y - (r/L_rb)*y.^2 - (p*y.^2)./(q+y.^2);
plot(y,f)
r is 0.65, L_rb is 5.4, p is 1.2 and q is 1. I get a blank plot when I run it.

採用された回答

Star Strider
Star Strider 2015 年 2 月 19 日
This is one problem:
y = linspace(0,20,0.5);
The third argument to linspace is the length of the vector it produces. (The default is 100.)
See if:
y = linspace(0,20);
improves things
  2 件のコメント
Russell
Russell 2015 年 2 月 19 日
Yep, thank you!
Star Strider
Star Strider 2015 年 2 月 19 日
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