ODE45 not solving Duffing Oscillator with negative nonlinear coefficient

4 Ansichten (letzte 30 Tage)
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;

Akzeptierte Antwort

Ameer Hamza
Ameer Hamza am 26 Mär. 2020
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
  1 Kommentar
Mohit Kumar
Mohit Kumar am 26 Mär. 2020
Alright, I actually figured it out.
What is happening is that for a negative value of b, when the initial conditions are high, the velocity and position keep on exponentially increasing.
Thanks for your help!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by