Using Hysdel
Hysdel3 uses the same syntax as an old version of Hysdel used to do, i.e.:
>> hysdel3('my_file.hys')
which will compile the file my_file.hys and create a file my_file.m in the current working directory. To get the MLD representation of the given hybrid system, simply call my_file:
>> my_file
This will create a Matlab structure called S which contains matrices of the mathematical model of the given hybrid system:
x(k+1) = A x(k) + B_u u(k) + B_aux w(k) + B_aff
y(k) = C x(k) + D_u u(k) + D_aux w(w) + D_aff
E_x x(k) + E_u u(k) + E_aux w(k) <= E_aff
To simulate the system, use the h3_mldsim function as follows:
>> [xn, y, w, feasible] = h3_mldsim(S, xk, uk)
where xk is the initial state, uk is the control input, xn is the calculated one-step state update, y is the output, w is the value of the auxiliary variables, and feasible is a binary flag indicating success of the simulation.