Borrar filtros
Borrar filtros

Homework question I don't understand

2 visualizaciones (últimos 30 días)
Celeste Knight
Celeste Knight el 23 de En. de 2015
Editada: Celeste Knight el 24 de En. de 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)

Respuestas (1)

Daniel Vasilaky
Daniel Vasilaky el 24 de En. de 2015
Editada: Daniel Vasilaky el 24 de En. de 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 comentario
Celeste Knight
Celeste Knight el 24 de En. de 2015
Editada: Celeste Knight el 24 de En. de 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

Iniciar sesión para comentar.

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by