How to solve a system of integro differential equation using numerical method?
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hewa selman
el 23 de Dic. de 2021
Comentada: Torsten
el 21 de En. de 2022
integro differential equation
0 comentarios
Respuesta aceptada
Torsten
el 24 de Dic. de 2021
Editada: Torsten
el 24 de Dic. de 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 comentarios
Torsten
el 24 de Dic. de 2021
Editada: Torsten
el 24 de Dic. de 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 ?
Más respuestas (3)
Torsten
el 28 de Dic. de 2021
Editada: Torsten
el 28 de Dic. de 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 comentarios
Torsten
el 29 de Dic. de 2021
Editada: Torsten
el 29 de Dic. de 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
el 3 de En. de 2022
Editada: Hewa selman
el 3 de En. de 2022
9 comentarios
Torsten
el 21 de En. de 2022
I hope you took z'(t) into account in the derivative and the integral terms.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!