# Solving coupled differential equations.

조회 수: 9 (최근 30일)
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 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 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 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