Diagrama de teia

De WikiLICC
Ir para: navegação, pesquisa

Em Scilab

r =2.0;               // parametro
N =20;                // numero de iteracoes
x(1) = 0.2;           // condicao inicial

for ic=1:N
 x(ic+1) = r*x(ic)*(1-x(ic)); 
end

clf;
t = 0:0.01:1;
plot(t,a*(t.*(1-t))); 
plot(t,t); 

plot([x(1) x(1)],[0 x(2)],'g') 
plot(x(1), x(1),'ko');
for ic=1:N-1
  plot([x(ic) x(ic+1)],[x(ic+1) x(ic+1)],'g')  
  plot([x(ic+1) x(ic+1)],[x(ic+1) x(ic+2)],'g')
  plot(x(ic+1), x(ic+1),'ko');
end
plot([x(N) x(N+1)],[x(N+1) x(N+1)],'g')