How to solve a system of integro differential equation using numerical method?
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hewa selman
am 23 Dez. 2021
Kommentiert: Torsten
am 21 Jan. 2022
integro differential equation
0 Kommentare
Akzeptierte Antwort
Torsten
am 24 Dez. 2021
Bearbeitet: Torsten
am 24 Dez. 2021
Simple.
Solve instead
dx/dt = t*x(t) + exp(t)*u(t), x(0) = 1
dy/dt = t^3*x(t) + exp(-t)*v(t), y(0) = 1
du/dt = exp(-t)*y(t), u(0) = 0
dv/dt = exp(t)*sin(x(t)), v(0) = 0
using one of the ODE solver from the MATLAB ODE suite, e.g. ODE15S,ODE45.
3 Kommentare
Torsten
am 24 Dez. 2021
Bearbeitet: Torsten
am 24 Dez. 2021
This works for your IDE from above, not for IDEs in general.
Do you really expect someone out there will write a code for you for the solution of general systems of IDEs ?
I think this would take some weeks or even months of work.
Hint for the du/dt and dv/dt terms:
What do you get if you differentiate
integral_{0}^{t} exp(-s)*y(s) ds
and
integral_{0}^{t} exp(s)*sin(x(s)) ds
with respect to t ?
Weitere Antworten (3)
Torsten
am 28 Dez. 2021
Bearbeitet: Torsten
am 28 Dez. 2021
function main
tspan = [0 10];
y0 = [1; 1; 0; 0];
[T,Y] = ode45(@fun,tspan,y0);
plot(T,[Y(:,1),Y(:,2)])
end
function dy = fun(t,y)
dy = zeros(4,1);
dy(1) = t*y(1) + exp(t)*y(3);
dy(2) = t^3*y(1) + exp(-t)*y(4);
dy(3) = exp(-t)*y(2);
dy(4) = exp(t)*sin(y(1));
end
This is the code for your original system of IDEs.
I don't know about the new system you wanted to solve with the code from above.
2 Kommentare
Torsten
am 29 Dez. 2021
Bearbeitet: Torsten
am 29 Dez. 2021
Seems to work as expected:
function main
y0 = 1 + 1i;
z0 = [1 1];
tspan = [0 2];
[t,y] = ode45(@complexfun, tspan, [y0,z0]);
figure
plot(t,[real(y(:,1)),imag(y(:,1))])
figure
plot(t,[y(:,2),y(:,3)])
end
function f = complexfun(t,y)
f = zeros(3,1);
f(1) = y(1)*t+2*1i;
f(2) = y(2)*t;
f(3) = y(3)*t+2;
end
Hewa selman
am 3 Jan. 2022
Bearbeitet: Hewa selman
am 3 Jan. 2022
9 Kommentare
Torsten
am 21 Jan. 2022
I hope you took z'(t) into account in the derivative and the integral terms.
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!