1

I am trying to use the following code:

ode1='D2y1=-1256.4*y1-5*Dy1+255.1*y2+182.781';   
ode2='D2y2=-151.5*y2-5*Dy2+255.1*y1-14.0459';   
CI='y1(0)=2,y2(0)=-2,Dy1(0)=0,Dy2(0)=0';

sol=dsolve(ode1,ode2,CI,'t');
sol.y1
sol.y2

and matlab returns an error:

??? Error using ==> mupadengine.mupadengine>mupadengine.feval at 144 MuPAD error: Error: Division by zero [_invert];

during evaluation of 'stdlib::normalNoExpand'

Error in ==> dsolve>mupadDsolve at 215 T = feval(symengine,'symobj::dsolve',sys,x,ignoreConstraints);

Error in ==> dsolve at 96 sol = mupadDsolve(ignoreConstraints,varargin{1:narg});

Error in ==> maglevsol at 7 sol=dsolve(ode1,ode2,CI,'t');

However, if i run this

ode1='D2y1=-y1-5*Dy1+255.1*y2+182.781';   
ode2='D2y2=-y2-5*Dy2+255.1*y1-14.0459';   
CI='y1(0)=2,y2(0)=-2,Dy1(0)=0,Dy2(0)=0';

sol=dsolve(ode1,ode2,CI,'t');
sol.y1
sol.y2

I get no errors at all. What's wrong? My version is r2011a

4

1 回答 1

0

由于 IC 的问题,Matlab 似乎无法解决这个问题。(通过尝试数值求解器给出 t=0 的导数的非数值)。我找不到解决方法(Matlab 2015a 实际上挂在这个上面,用于分析解决方案)。

但是 Maple 能够解决它(Maple 在 ODE 中非常好)。这是解决方案和图表(对所有这些硬编码的数值使用符号也是一个好主意,然后在最后使用 subs。不需要到处都有幻数)。您可能想将此报告给 Mathworks

restart;
ode1 := diff(y1(t),t$2) = a*y1(t) + b*diff(y1(t),t)+ c*y2(t) + d;
ode2 := diff(y2(t),t$2)= e*y2(t) + b*diff(y2(t),t)+ c*y1(t) + f;
ic := y1(0) = 2, y2(0) = -2, D(y1)(0) = 0, D(y2)(0) = 0;
sol:=dsolve({ode1, ode2, ic}, {y1(t), y2(t)}):
sol:=subs( {a = -1256.4, b = -5, c= 182.781, e = -151.5, f = -14.0459,d=182.781},sol);


sol := {y1(t) = (-.1922320350+0.5088536230e-1*I)*
exp((-2.500000000+9.444367980*I)*t)+(1.096005949-0.7581365270e-1*I)*
exp((-2.500000000+36.14144316*I)*t)+(-.1922320331-0.5088536185e-1*I)*
exp((-2.500000000-9.444367980*I)*t)+(1.096005952+0.7581365750e-1*I)*
exp((-2.500000000-36.14144316*I)*t)+.1924521734, 

y2(t) = (-.8748433300+.2315780499*I)*exp((-2.500000000+9.444367980*I)*t)+
(-.2408287839+0.1665876887e-1*I)*exp((-2.500000000+36.14144316*I)*t)+
(-.8748433212-.2315780478*I)*exp((-2.500000000-9.444367980*I)*t)+
(-.2408287844-0.1665876992e1*I)*
exp((-2.500000000-36.14144316*I)*t)+.2313442207}

这是 y1(t) 和 y2(t) 2 秒的解图

数学图形

数学图形

于 2015-04-05T01:12:22.977 回答