Homework question I don't understand

I've been given this homework problem that involves finding the range of the initial value for the number of the population infected in a week for some disease spread. I don't quite understand how to go about answering the question and translating it in code. Attached is the homework problem pdf and below is what I came up with so far (I know this code doesn't work)
for n=1:100
R=(x(n+1)^2)/x(n)-((x(n))^2);
(0<x(1))&&(x(1)<1);
x(n+1)=R*x(n)*(1-x(n));
end
plot(x)

답변 (1개)

Daniel Vasilaky
Daniel Vasilaky 2015년 1월 24일
편집: Daniel Vasilaky 2015년 1월 24일

0 개 추천

Look at the plot for various x and R. Remember that R=4.6692016091 is a critical point. For example, if say x=.02 and R=4<4.6692016091 , we get unstable plot. For R=1 we smoothly converge to 0. Here is the code for x=.02 and R=4.
x=.02; % initialize x
for i=1:100, %loop say 100 times
x=4*(x-x^2); % Set R=4,this is the recurrence x_i+1=4*(x_i - x_i^2)
t(i,1)=i;% store i in the first column of 100-by-2 matrix
t(i,2)=x;% store x in the second column
end;
plot(t(:,1),t(:,2)); % plot the 1st column vs. 2nd column.
It's a start, hope it helps.

댓글 수: 1

Celeste Knight
Celeste Knight 2015년 1월 24일
편집: Celeste Knight 2015년 1월 24일
how exactly did you find R in the first place? and when i try to edit my code to what you have posted i just get an error

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

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

태그

질문:

2015년 1월 23일

편집:

2015년 1월 24일

Community Treasure Hunt

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

Start Hunting!

Translated by