Solving coupled differential equations.
조회 수: 2 (최근 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)')
댓글 수: 0
답변 (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
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?
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!