필터 지우기
필터 지우기

Error using vertcat ; Dimensions of arrays being concatenated are not consistent.

조회 수: 1 (최근 30일)
Anshuman
Anshuman 2022년 9월 10일
답변: Chunru 2022년 9월 11일
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)

답변 (1개)

Chunru
Chunru 2022년 9월 11일
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)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by