I would like to write a Matlab code for an angular velocity of this type:
$\omega=\omega_{fb}+sat(\omega_{ff})$
where $\omega_{fb}$ is a feedback angular velocity and $\omega_{ff}$ is a feedforward angular velocity.
As you can see, the feedforward term has been saturated.
The problem is that there is not a saturation function in Matlab. Moreover, I would like to do this inside a Matlab function block, and not use the saturation block of Simulink.
I have heard that some use the atan() function to perform the saturation, but I am not sure I can do this.
So, my question is:
How can I define the saturation function in Matlab?