How to find an approximate solution to a perturbed differential equation in Matlab?
Mostrar comentarios más antiguos
Hi,
I need to be able to find an approximate solution using ode45 to a perturbed differential equation (specifically, x''-x=epsilon*t*x) where epsilon is much smaller than 1.
I understand how to use ode45 to solve the differential equation without the perturbation, but what does it mean to solve the Diff EQ with epsilon not equal to zero?
Thanks for any help!
Respuestas (1)
Mischa Kim
el 9 de Abr. de 2014
Editada: Mischa Kim
el 9 de Abr. de 2014
Connie, the unperturbed differential equation is simply
x'' - x = 0 % or should it rather say x'' + x = 0?
which you can solve analytically and by hand. For the perturbed case just look at the equation as a standard differential equation, which you solve, as you mentioned, using e.g. ode45.
function pertODE()
tspan = 0:0.1:10;
IC = [1 1];
epsilon = 0.05;
[t,X] = ode45(@myODE,tspan,IC,[],epsilon);
x = X(:,1);
v = X(:,2);
plot(t,x,'r')
xlabel('t')
ylabel('x')
grid
end
function dY = myODE(t,y,epsilon)
dY = zeros(2,1);
x = y(1);
v = y(2);
dY = [ v;...
-x + epsilon*t*x];
end
Categorías
Más información sobre Ordinary Differential Equations en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!