Example of how to use ODE23 in MATLAB: make two files such as call_plant.m and plant.m as shown below; note that in this example, the differential equations in plant.m contain a switch function.

At the MATLAB prompt, type: "call_plant"

% call_plant.m
x0 = [-1 2];
[T,x]=ode23('plant', [0 20], x0);

% plant.m
function [xdot] = plant(t,x)
if x(2)>=0
F = 1;
else
F = -1;
end;
xdot(1) = x(2);
xdot(2) = x(1) + F;
xdot = xdot';