Matlab - convertir de matlab a scilab

 
Vista:

convertir de matlab a scilab

Publicado por Daniela (1 intervención) el 06/04/2020 00:09:53
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
function epidemia
beta=0.03;
gamma=2;
x0=100;
y0=20;
z0=10;
tmax=6;
[t,x]=ode45(@epi, [0 tmax], [x0,y0,z0]);
 
subplot(3,1,1), plot(t,x(:,1)),title('Susceptibles');
subplot(3,1,2), plot(t,x(:,2)),title('Infectados');
subplot(3,1,3), plot(t,x(:,3)),title('Recobrados');
 
    function dx=epi(t,x)
        dx=zeros(3,1);
        dx(1)=-beta*x(1)*x(2);
        dx(2)=+beta*x(1)*x(2)-gamma*x(2);
        dx(3)=+gamma*x(2);
    end
end
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
-1
Responder