Where μ = 1200, t is from 0 to 7000, and ODE15s is to be used.
tfinal = 7000;delta_t = 0.01;t = [0:delta_t:tfinal];initial = [1 1]; % initial conditions
[t,w] = ode15s(@sub2,t,initial); % line with error
figureplot(t,w,'LineWidth',2) %%%%%%%%%% Subfunction
function d_dt = sub2(t,w) mu = 1200;% turning d^2y/dt^2 = mu(1-y^2)dydt - y into dzdt = mu(1-y)^2 - y
% dydt = z
z = w(1); y = w(2);d_dt = zeros(2, 1); % initialize the column vector of equations
d_dt(1,1) = mu*z*(1-y)^2 - y; % first equation
d_dt(2,1) = z; % second equation
end
I made the code above, but i keep getting the error:
Warning: Failure at t=1.702777e-01. Unable to meet integration tolerances without reducing the step size below thesmallest value allowed (4.440892e-16) at time t. > In ode15s (line 730) In sec_ord_diff (line 5)
I think it has something to do with μ being too large, or maybe the time step is too small/ big. Can anyone help me fix the issue? Thank you
Best Answer