How do I either loop or iterate the variable?
Mostra commenti meno recenti
x n+1=4rx n(1-x n)
r = 0.2
x = 0.6
x0 = ones(0,30);
I have declared all of my variables but loop is not working. Should I be using iteration? Can someone please help me.
EDU>> x0 = ones(0,30);
for i = x0 +1; i=30
x0 = 4*r*x*(1-x)
end
1 Commento
Martin Brown
il 23 Nov 2013
Risposte (1)
Roger Stafford
il 22 Nov 2013
Your loop is not working for a number of reasons. Is the following what you have in mind?:
n = 30;
r = 0.2;
x = zeros(1,n+1);
x(1) = 0.6;
for i = 1:n
x(i+1) = 4*r*x(i)*(1-x(i));
end
Categorie
Scopri di più su Loops and Conditional Statements in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!