Error using vertcat ; Dimensions of arrays being concatenated are not consistent.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to use the following code for solving a system of 3 ode. I am getting error which running this code.
beta = 0.1;
delta = 0.05;
max_time = 100;
S0 = 0.95;
I0 = 0.05;
R0 = 0.0;
dXdt = @(t,X) [ -beta*X(1)*X(2); beta*X(1)*X(2) -delta*X(2); delta*X(2)];
[t,X] = ode45(dXdt, [0 max_time],[S0 I0 R0]);
figure
plot(t,X)
0 comentarios
Respuestas (1)
Chunru
el 11 de Sept. de 2022
beta = 0.1;
delta = 0.05;
max_time = 100;
S0 = 0.95;
I0 = 0.05;
R0 = 0.0;
dXdt = @(t,X) [ -beta*X(1)*X(2); beta*X(1)*X(2)-delta*X(2); delta*X(2)];
% ^ No space here
[t,X] = ode45(dXdt, [0 max_time],[S0 I0 R0]);
figure
plot(t,X)
0 comentarios
Ver también
Categorías
Más información sobre Ordinary Differential Equations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!