Info
この質問は閉じられています。 編集または回答するには再度開いてください。
What's wrong with this code?
1 回表示 (過去 30 日間)
古いコメントを表示
I am getting this error msg. Please find me the mistakes here.
In an assignment A(I) = B, the number of elements in B and I must be the same.
r=[2.0 3.1 3.5 3.65 3.84 3.95];
x=[];
x(1)=0.35;
f=@(x) r*x*(1-x);
N=40;
for t=1:N-1;
x(t+1)=f(x(t));
end
hold on
plot(x,'r-')
0 件のコメント
回答 (2 件)
Joseph Cheng
2014 年 3 月 21 日
yes thats because you are including information that is not here and in your other posting that was flagged. but looks like you have it so we're all set?
3 件のコメント
Joseph Cheng
2014 年 3 月 21 日
only rude comment from me would be that posting on a forum for assignment questions involving things besides what type of functions to use, function errors, random matlab issues, and approaches to handling data is cheating. The Teaching Assistant or office hours should be where assignment related questions be asked.
Joseph Cheng
2014 年 3 月 21 日
編集済み: Joseph Cheng
2014 年 3 月 21 日
Were you attempting to do this?
r=[2.0 3.1 3.5 3.65 3.84 3.95];
x=[];
x(1,:)=0.35*ones(size(r));
f=@(x) r*x*(1-x);
N=40;
for t=1:N-1;
x(t+1,:)=f(x(t));
end
hold on
plot(x)
legend('r = 2.0','r = 3.1', 'r = 3.65')
Where the first value of x is 0.35? or you can re-write it such that the function
f=@(x,r) r*x*(1-x);
such that you write a for loop to cycle in the r you need.
8 件のコメント
Joseph Cheng
2014 年 3 月 21 日
no it doesn't make sense. how do they look different? shape? amplitude?
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!