How do I either loop or iterate the variable?

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

Martin Brown
Martin Brown 2013년 11월 23일
Thank you very much. That worked perfectly. How am on to plotting the points. I have a lot to learn about programming.

댓글을 달려면 로그인하십시오.

답변 (1개)

Roger Stafford
Roger Stafford 2013년 11월 22일

0 개 추천

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

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품

질문:

2013년 11월 22일

댓글:

2013년 11월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by