I have to solve a dynamics problem with MATLAB. I have two differential equations which are only valid for positive resp. negative values of the angle theta. I already transformed them in to the state space, where
y=[theta(t); dtheta(t)] and so dy/dt = dy = [dtheta(t); ddtheta(t)]
with theta(t) the angle, dtheta(t) the velocity and ddtheta(t) the acceleration.
function dy = cylinder_DGL_(t,y,Sys)
m = Sys.m;
r = Sys.r;
h = Sys.h;
R = Sys.R;
value = Sys.value;
alpha = Sys.alpha;
And then the integration in the script with:
[t,y] = ode45(@(t,y)cylinder_DGL(t,y,Sys),time_r,IC);
What do I have to do now, so that only the valid is used during ODE 45 integration?