Coupled Differential Equations - derivatives on both sides of equations
조회 수: 2 (최근 30일)
이전 댓글 표시
I am trying to solve two coupled differential equations, but I cannot seem to figure out how to get into a form that can be solved with an ode solver. Specifically, I can't get all the derivatives to the left hand side of the equations.
The equations are:
dx/dt=[-1.005*x+0.0000265*dy/dt+0.01*y+f(t)*g1(x,t)]*1/(0.000053+g1(x,t))
dy/dt=[-0.872*y+0.0000265*dx/dt+0.01*x-f(t)*g2(y,t)]*1/(0.000053+g2(y,t))
Where:
f(t)=44100*cos(1.48-377*t)-3888*exp(-33.3*t)
g1(x,t)=24800/(126+.55*abs(117*sin(377*t-1.48)-117*sin(-1.48)*exp(-t/0.03)-x)*240)^2
g2(y,t)=24800/(126+.55*abs(117*sin(377*t-1.48)-117*sin(-1.48)*exp(-t/0.03)+y)*240)^2
Any help would be greatly appreciated.
댓글 수: 0
채택된 답변
Andrew Newell
2017년 8월 27일
편집: Andrew Newell
2017년 8월 27일
Let's simplify things a little bit so we can better see what is going on. Let
Y = [x; y];
G1(t,Y) = 0.000053+g1(Y(1),t);
G2(t,Y) = 0.000053+g2(Y(2),t);
Then a little rearrangement gives
G1(t,Y)*(d/dt)Y(1) - 0.0000265*(d/dt)Y(2) = F1(t,Y)
G2(t,Y)*(d/dt)Y(2) - 0.0000265*(d/dt)Y(1) = F2(t,Y)
where F1(t,Y) and F2(t,Y) bundle all the remaining terms together. If we now define a "mass matrix"
M(t,Y) = [G1(t,Y) -0.0000265; -0.0000265 G2(2,Y)]
F(t,Y) = [F1(Y,t); F2(Y,t)];
then we can define
options = odeset('Mass',M);
and solve something like
[t,y] = ode45(F,tspan,y0)
(see the ode45 documentation). You'll have to define functions F(t,Y) and M(t,Y) to reproduce the above steps. Warning: I have been using a mixture of MATLAB and regular math to keep it simple; you can sort out the details.
댓글 수: 3
Andrew Newell
2017년 8월 28일
I made two modifications to your code. The first is to change the definition of Fn to
function Ydot=Fn(t,Y)
and the second was to change the final command to
[t,y]=ode45(@Fn,t,[0;0],options);
Then it ran fine.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!