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;
Best Answer