odes with variable coefficients

3 次查看(过去 30 天)
i am solving system of linear ode with time varying (gaussian )coefficients using standard ode45 approach but i am not getting desired results ,do i need to make some changes to accomodate time variartion of coefficients ? below i copy pasted from my m file along with command
% function dy=tarak(t,y)
g0=.1;
t0=200;
s=90;
g=g0*exp(-((t-t0)/s).^2);%time varying gaussian coefficient "g"
G=sqrt(10);
dy=zeros(5,1);
dy(1)=-2*2*y(1)+1i*G*conj(y(3))+1i*g*conj(y(4))-1i*G*y(3)-1i*conj(g)*y(4);
dy(2)=2*y(1)+1i*G*y(3)-1i*G*conj(y(3));
dy(3)=-2*y(3)+1i*G*y(2)+1i*g*conj(y(5))-1i*G*y(1);
dy(4)=-2*y(4)+1i*G*y(5)+1i*g*(1-y(1)-y(2))-1i*g*y(1);
dy(5)=1i*G*y(4)-1i*g*conj(y(3));
Command [T,Y] = ode45(@tarak,[0 ,500],[0 0 0 0 0]);
Thanks for your time

采纳的回答

Torsten
Torsten 2015-4-1
Here are the results.
Best wishes
Torsten.
  6 个评论
Torsten
Torsten 2015-4-1
If you don't succeed, download "scilab" and execute the attached code.
Best wishes
Torsten.
harman singh
harman singh 2015-4-2
编辑:harman singh 2015-4-2
hi Torsten , you were right by strengthening the tolerance level i am getting the much required positive results .
options = odeset('AbsTol', 1e-12); [T,Y] = ode45(@tarak, [0, 500], [0 0 1 0 0 0 0 0 0], options);
Thanks for your help .

请先登录,再进行评论。

更多回答(1 个)

Torsten
Torsten 2015-3-18
Formally, everything looks fine. Of course we don't know if your underlying equations are correct.
Are you sure ODE45 can handle complex-valued ODEs ?
Best wishes
Torsten.
  3 个评论
harman singh
harman singh 2015-3-23
编辑:harman singh 2015-3-23
"Are you sure ODE45 can handle complex-valued ODEs" ? hi i found this
The ODE solvers in MATLAB 5 (R12) and later releases properly handle complex valued systems."MathWorks Support Team on 26 Jul 2010"
harman singh
harman singh 2015-4-1
hi Torsten, i have transformed my equations into real form
now these are 9 equations
dy(1)=-2*2*y(1)+2*G*y(5)+2*g*y(7);
dy(2)=2*y(1)-2*G*y(5);
dy(3)=2*y(1)-2*g*y(7);
dy(4)=-2*y(4)+g*y(9);
dy(5)=-2*y(5)+G*(y(2)-y(1))+g*y(8);
dy(6)=-2*y(6)-G*y(9);
dy(7)=-2*y(7)+g*(y(3)-y(1))+G*y(8);
dy(8)=-G*y(7)-g*y(5);
dy(9)=G*y(6)-g*y(4);
where where Coefficient G =3.16
and g = 0.1*exp(-((t-200)/90).^2) % gaussian time dependent coefficient " g"
t= time 0:500 , Initial Condition [0 0 1 0 0 0 0 0 0]
can you pls try ode45 on above equations and copy paste results here . thanks

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by