Azzera filtri
Azzera filtri

Homework question I don't understand

2 visualizzazioni (ultimi 30 giorni)
Celeste Knight
Celeste Knight il 23 Gen 2015
Modificato: Celeste Knight il 24 Gen 2015
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)

Risposte (1)

Daniel Vasilaky
Daniel Vasilaky il 24 Gen 2015
Modificato: Daniel Vasilaky il 24 Gen 2015
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 Commento
Celeste Knight
Celeste Knight il 24 Gen 2015
Modificato: Celeste Knight il 24 Gen 2015
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

Accedi per commentare.

Categorie

Scopri di più su Programming in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by