[問題]dsolve初始值 迴圈

作者: midfing (蛙特惹法克)   2016-03-15 17:35:35
如題
想把ODE的初始值帶入迴圈
i=1;
while i<2
eqn = 'D2x+3*Dx+2*x = dirac(t-3)';
inits = 'x(0)=i,Dx(0)=0'
x=solve(eqn,inits,'t')
i=i=0.5;
end
有試著照版上類似的問題將第4行改成
eval(['inits=''x(0)=',num2str(i),'Dx(0)=0'])
但還是出現
error:A MATLAB string constant is not terminated properly
作者: JamesChen (James)   2016-03-16 10:27:00
你至少附上 error code 吧

Links booklink

Contact Us: admin [ a t ] ucptt.com