Undefined function 'int' for input arguments of type 'double'.
이전 댓글 표시
syms x S1(x) E1(x) I1(x) R1(x) h1 h2 h3 h4 C1 C2 C3 C4
b = 0.001; w = 0.01; g = 0.02; NS = 497; NE = 1; NI = 1; NR = 1;
EQ = [ diff(S1,x) == 0, diff(E1,x) == 0, diff(I1,x) == 0, diff(R1,x) == 0 ];
SN = dsolve(EQ); fS1 = SN.S1; fE1 = SN.E1; fI1 = SN.I1; fR1 = SN.R1;
S(1) = NS; E(1) = NE; I(1) = NI; R(1) = NR;
for m = 2 : 7
for k = 1 : m - 1
S(m) = h1 * ( int( diff(S(m-1)) + b * S(k) * I(m-k) ));
E(m) = h2 * ( int( diff(E(m-1)) - b * S(k) * I(m-k) + w * E(k) ));
I(m) = h3 * ( int( diff(I(m-1)) - w * E(k) + g * I(k) ));
R(m) = h4 * ( int( diff(R(m-1)) + g * I(k) ));
end
end
SA = fS1 + S(1) + S(2) + S(3) + S(4) + S(5) + S(6) + S(7);
hS = subs(SA,h1,-1:0.25:1); figure(1),fplot(hS,[0 5])
댓글 수: 6
P.K. Pattnaik
2022년 6월 29일
Then define S, E, l and R as syms arrays.
And add the integration variable in the int command:
syms S [2,1]
syms x
S(1) = 0.2;
S(2) = int(S(1),x)
Same in the diff command.
P.K. Pattnaik
2022년 6월 29일
Torsten
2022년 6월 29일
And you defined all arrays to be symbolic ?
P.K. Pattnaik
2022년 6월 29일
편집: P.K. Pattnaik
2022년 6월 29일
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Code Performance에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
