How to find an approximate solution to a perturbed differential equation in Matlab?

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!

Answers (1)

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

Categories

Find more on Numerical Integration and Differential Equations in Help Center and File Exchange

Asked:

Sam
on 9 Apr 2014

Edited:

on 9 Apr 2014

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!