Error using sym/subsindex (line 853)
이전 댓글 표시
a = 2;
t=0:0.001:2;
b = 3;
c = -9;
d = 0;
syms y(t) il1(t) il2(t);
y(t) = [il1(t); il2(t)];
ode = diff(y(t),t) == [a b;c d]*[il1(t);il2(t)] + [d a;c b]*[b*heaviside(t) + d*cos(3*t);c*exp(-d*t)]
cond = y(0) == [a;c]
ySol(t) = dsolve(ode,cond)
Error using sym/subsindex (line 853) i get this error where did i do wrong
답변 (2개)
Sulaymon Eshkabilov
2021년 5월 27일
Hi,
Here is the corrected solution:
clearvars
a = 2;
b = 3;
c = -9;
d = 0;
syms t y(t) il1(t) il2(t);
y = [il1; il2];
Dy=diff(y,t);
EQN = Dy == [a b;c d]*[il1;il2] + [d a;c b]*[b*heaviside(t)+d*cos(3*t); c*exp(-d*t)]
cond = y(0) == [a;c]
ySol = dsolve(EQN, il1(0)==2, il2(0)==-9);
IL1 = ySol.il1
IL2 = ySol.il2
a = 2;
t=0:0.001:2;
b = 3;
c = -9;
d = 0;
syms y(t) il1(t) il2(t);
y(t) = [il1(t); il2(t)];
ode = diff(y(t),t) == [a b;c d]*[il1(t);il2(t)] + [d a;c b]*[b*heaviside(t) + d*cos(3*t);c*exp(-d*t)]
cond = y(0) == [a;c]
ySol(t) = simplify(subs(y,dsolve(ode,cond)))
카테고리
도움말 센터 및 File Exchange에서 Equation Solving에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

