I'm working on the numerical integration to a discontinuous ODE in MATLAB, but I'm not getting the results I intended to get.
I have a 2-dof system of two masses connected via springs. (see 2-dof system)
My function in MATLAB is of the form:
function [ xdot ] = two_springs(t, x, m1, m2, c, g, k)
% x(1) = x1
% x(2) = x1'
% x(3) = x2
% x(4) = x2'
delta = max(x(3,1) - x(1,1), 0); % (Discontinuous)
F = k * delta^(3 / 2);
xdot(1,1) = x(2,1);
xdot(2,1) = (-F + m1 * g) / m1;
xdot(3,1) = x(4,1);
xdot(4,1) = (F - c * x(3,1) + m2 * g) / m2;
end
Afterwards I plot force F over time.
But no matter which solver I use ( ode45, ode23, ode113, ode15s, ode23s,...) I get a failure because the step size was reduced below the smallest value allowed. The topic: MATLAB- ode solver: Unable to meet integration tolerances did unfortunately not help me.
Does anyone have an idea what else I could try?
Thank you very much for your help!
tine-lore