Solving coupled differential equations.

1 次查看(过去 30 天)
I am tryng to solce the following coupled diferrential equations., , where and . I have developed a code to solve a single and simpler euqation of this form using the finite difference algorithm, but I am unsure how to extend this to solve these coupled equations. The code is as follows:
close all
Omega = 0.3;
dt = 0.1;
Ns = 1000;
ds = dt/Ns;
t = 0:dt:10;
N = numel(t);
c = zeros(1,N);
c(1) = 1;
v = 0;
for n = 1:N-1 % Outer loop; c is updated each iteration of this loop
% Inner loop: c is taken to be constant through this loop, the same
% approximation as is made in section 5.2.1 of the pdf.
for nn = 1:Ns
v = v - (1i*Omega*v + c(n))*ds; %insert f(t,s) here
end
c(n+1) = c(n) + v*dt;
end
plot(t,real(c),'.'),grid
xlabel('t'),ylabel('real(c)')

回答(1 个)

Bjorn Gustavsson
Bjorn Gustavsson 2021-9-15
The first trick to try with these coupled integro-differential equations is to try to "differentiate away the integrals":
which becomes:
which simplifies to:
This now have become a second order ode, to my brief look it seems as if the second ode also should be convertable in the same way. Then you just have to convert the 2 second-order odes to 4 first order odes, but that I assume is standard to you.
HTH
  2 个评论
Jose Aroca
Jose Aroca 2021-9-15
First of all, thank you for your answer. I see what you mean, but I am not sure it will work with these equations. The functions g1(2) and f1(2) depend on both t and s, so you cannot differentiate the integrals with respect to t. That is why I was trying to use the finite difference algorithm.
Bjorn Gustavsson
Bjorn Gustavsson 2021-9-15
Ops, I missed that. But I still think you can use that trick, it will not simplify that nicely, but you will still get some kind of simplification if you split up the integral from 0 to t+dt into the sum of two integrals, from 0 to t and from t to t+dt, then you can combine the integrals from 0 to t and slog through a couple of more steps, swap order of differentiation and integration by parts?

请先登录,再进行评论。

类别

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

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by