Solving coupled differential equations.

9 ビュー (過去 30 日間)
Jose Aroca
Jose Aroca 2021 年 9 月 15 日
コメント済み: Bjorn Gustavsson 2021 年 9 月 15 日
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 Center および File ExchangeProgramming についてさらに検索

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by