0
$\begingroup$

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?

$\endgroup$
2
$\begingroup$

You could always employ conditional expressions that are clear and explicit. Instead, if you like compact forms, you may implement saturation as below:

w = w_fb + min(hi, max(low, w_ff));

where hi and low are the upper and lower bounds of the saturation.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.