3. Logístico asintótico

3.1 En la siguiente rutina, están asignados los valores de: tiempo (t), capacidad de carga (k), población inicial (n) y tasa de crecimiento (r), corresponden a 20, 2, 5 y 3 respectivamente.

printf("Logistico asintotico\n");
t=20;
k=2;
n=5;
r=3;
x=zeros(64,1);
tp=(0:t-1);
Nt=zeros(t,1);
for j=1:t
  Nt(j)=n;
  Nt;
tablero=zeros(64,1);
  for i=1:n
    x=randi(64);
    tablero(x)=tablero(x)+1;

endfor
a1=tablero([1:8]);
a2=tablero([9:16]);
a3=tablero([17:24]);
a4=tablero([25:32]);
a5=tablero([33:40]);
a6=tablero([41:48]);
a7=tablero([49:56]);
a8=tablero([57:64]);
tablero2=[a1,a2,a3,a4,a5,a6,a7,a8]';
s=tablero;

rr=zeros(64,1);
for i=1:64
    if (s(i)<k)
        rr(i)=s(i)*r;

    end

end
     rr;
r1=sum(rr);

so=zeros(64,1);
for i=1:64
    if (s(i)==k)
        so(i)=s(i)*1;

  end
end

soe=zeros(64,1);
for i=1:64
    if (s(i)>k)
        soe(i)=(s(i)*0)+k;

    end
end

so;
soe1=sum(soe);
so1=sum(so);
pasan=r1+so1+soe1;
n=pasan;
endfor
plot(tp,Nt)
xlabel ("t");
ylabel ("Nt");
title ("Crecimiento logistico asintotico Nt vs t");
t_vs_Nt=[tp',Nt]

3.2 En la siguiente rutina son asignados por el usuario los valores de: tiempo (t), capacidad de carga (k), población inicial (No) y tasa de crecimiento (r). Se recomienda asignar capacidades de carga bajas y tasas de crecimiento mayores o iguales a 3.

printf("Logistico asintotico\n");
t = input('Ingrese los tiempos o repeticiones, t: ');
n = input('Ingrese la población inicial, No: ');
k = input('Ingrese la capacidad de carga, k: ');
r = input('Ingrese la tasa de crecimiento, r: ');
x=zeros(64,1);
tp=(0:t-1);
Nt=zeros(t,1);
for j=1:t
  Nt(j)=n;
  Nt;
tablero=zeros(64,1);
  for i=1:n
    x=randi(64);
    tablero(x)=tablero(x)+1;

endfor
s=tablero;

rr=zeros(64,1);
for i=1:64
    if (s(i)<k)
        rr(i)=s(i)*r;

    end

end
     rr;
r1=sum(rr);

so=zeros(64,1);
for i=1:64
    if (s(i)==k)
        so(i)=s(i)*1;

  end
end

soe=zeros(64,1);
for i=1:64
    if (s(i)>k)
        soe(i)=(s(i)*0)+k;

    end
end

so;
soe1=sum(soe);
so1=sum(so);
pasan=r1+so1+soe1;
n=pasan;
endfor
plot(tp,Nt)
xlabel ("t");
ylabel ("Nt");
title ("Crecimiento logistico asintotico Nt vs t");
t_vs_Nt=[tp',Nt]