matlab - Error in dsolve when variable is multiplied by a constant (R2011a) -
matlab - Error in dsolve when variable is multiplied by a constant (R2011a) -
i trying utilize next 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 error:
??? error using ==> mupadengine.mupadengine>mupadengine.feval @ 144 mupad error: error: partition 0 [_invert];
during evaluation of 'stdlib::normalnoexpand'
error in ==> dsolve>mupaddsolve @ 215 t = feval(symengine,'symobj::dsolve',sys,x,ignoreconstraints);
error in ==> dsolve @ 96 sol = mupaddsolve(ignoreconstraints,varargin{1:narg});
error in ==> maglevsol @ 7 sol=dsolve(ode1,ode2,ci,'t');
however, if 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 no errors @ all. what's wrong? version r2011a
it seems matlab not able solve this, due issue ic. (non numerical value derivative @ t=0 given trying numerical solver). not find way around (matlab 2015a hangs on this, analytical solution).
but maple able solve (maple in ode's). here solution , plots (it thought utilize symbolic hardcoded numerical values , utilize subs @ end. no need have magic numbers on place). might want study 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}
here solution plots of y1(t) , y2(t) 2 seconds
matlab system ode dsolve
Comments
Post a Comment