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!
답변 (1개)
Mischa Kim
2014년 4월 9일
편집: Mischa Kim
2014년 4월 9일
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
카테고리
도움말 센터 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!