Hi!
I have function: bfun:
function x = bfun(r)
n=30;
x(1:n)=0.5;
for k = 2:n
x(k) = x(k-1)*r*(1-x(k-1));
end
And main program:
r = 3.7;
y = bfun(r);
plot(y,r,'x');
And it plot one line for r=3.7 I want to set r=1:0.1:7 and plot something like this:
But i cant find the way. Always got "error a(i) = x x must have the same size as i" Someone can help me, please?

 採用された回答

Chad Greene
Chad Greene 2015 年 2 月 2 日

0 投票

You only have one value for r (3.7), but you have many values for y. The plot function wants exactly one r value for each y value.

その他の回答 (0 件)

カテゴリ

タグ

質問済み:

2015 年 2 月 2 日

回答済み:

2015 年 2 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by