Undefined function 'int' for input arguments of type 'double'.
Show older comments
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 Comments
P.K. Pattnaik
on 29 Jun 2022
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
on 29 Jun 2022
Torsten
on 29 Jun 2022
And you defined all arrays to be symbolic ?
P.K. Pattnaik
on 29 Jun 2022
Edited: P.K. Pattnaik
on 29 Jun 2022
Answers (0)
Categories
Find more on Code Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!