Skip to content
Snippets Groups Projects
Select Git revision
  • 02a0847213734d473e8c9d09e058537df6764efe
  • master default
2 results

main.m

Blame
  • main.m 801 B
    clear figure
    
    S = 990;
    I = 10;
    R = 0;
    n_pop = S + I + R;
    
    input = [S, I, R];
    
    coeffs = options;
    coeffs.InfectionRate = 0.06;
    coeffs.ImmunisationRate = 0.01;
    coeffs.ImmunisationLossRate = 0.001;
    coeffs.VaccinationRate = 0.02;
    coeffs.DeathRate = 0.04;
    coeffs.NaturalDeathRate = 0.002;
    coeffs.NatalityRate = 0.003;
    
    N = 10000;
    
    Slist = zeros(1, N);
    Ilist = zeros(1, N);
    Rlist = zeros(1, N);
    
    t = 1:N;
    
    for i=t
        input = step(input, coeffs);
        Slist(i) = input(1);
        Ilist(i) = input(2);
        Rlist(i) = input(3);
    end
    
    % figure
    % hold on
    % plot(t, Slist);
    % plot(t, Ilist);
    % plot(t, Rlist);
    % plot(t, Dlist);
    area([Slist.', Ilist.', Rlist.']);
    
    legend('Susceptible', 'Infected', 'Immunized');
    title('Evolution of virus in population');
    xlabel('Time');
    ylabel('Population');
    % axis([1, N, 0, n_pop]);