ODE45 not solving Duffing Oscillator with negative nonlinear coefficient
4 次查看(过去 30 天)
显示 更早的评论
Hi,
I'm trying to solve the duffing oscillator with a negative nonlinear coefficient (named b, see below). When I do so, ode45 gives me the warning and doesnt finish the integration -
Warning: Failure at t=1.362484e+00. Unable to meet integration tolerances without reducing the step size below the smallest value
allowed (7.105427e-15) at time t.
I get the correct solution for positive nonlinear coefficients (named b, see below).
My function is as follows -
function u_d=get_acc_duff(t,u,abd,g,omega)
% abd=[a b d]
theta=u(1);
theta_d=u(2);
theta_dd=g*cos(omega*t)-abd(3)*theta_d-abd(1)*theta-abd(2)*theta^3;
u_d=[theta_d;theta_dd];
end
ODE45-
ui=[0;15]
[T,U]=ode45(@(t,u) get_acc_duff(t,u,ABD,g,omega),tspan,ui);
Values used -
a=1; % coeff of x
b=-0.04; % coeff of x^3
d=0.1; % coeff of x_d
ABD=[a b d];
omega=1.4;
ti=0;
tf=200;
tstep=0.1;
tspan=ti:tstep:tf;
0 个评论
采纳的回答
Ameer Hamza
2020-3-26
This warning indicates that your system is unstable for the given value of parameters, and the response of the system is diverging to infinity. This is not the issue of MATLAB, and it is the property of ODE itself. I don't know much about Duffing Oscillator, but from this article http://www.scholarpedia.org/article/Duffing_oscillator it can be found that for the system can be sometimes unstable. I tried some different values for some parameters, and you can see that ode45 gives a stable response if you use
a=10; % coeff of x
b=-0.04; % coeff of x^3
d=0.1; % coeff of x_d
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Ordinary Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!