Home > database >  matlab
matlab

Time:01-23

The function dy=odesir (t, y, beta, gamma)
Dy=[- beta * y (1) * y (2); the beta * y (1) * y (2) - gamma * y (2), gamma * y (2)];
N=100; Beta=0.01; Gamma=0.1;
Tspan=[0:50]; Y0=[0] 99;
/t, y=ode45 (@ odesir tspan, y0, [], beta, gamma);
The plot (t, y);
Xlabel (' time ');
Ylabel (' population ');
Legend (' S ', 'I', 'R')
End

Run out, the old tip "less than the number of input parameters, which step has a problem solving, thank you!