Saturation function

float uz_signals_saturation(float input, float upper_limit, float lower_limit)

Returns one sample which either limits the input signal to the lower or upper limit, or passes the input signal through. Functions very similar to the saturation block in Simulink.

Parameters:
  • input – Any input signal

  • upper_limit – Upper limit of the saturation

  • lower_limit – Lower limit of the saturation. upper_limit > lower_limit is required

Returns:

Returns one sample of the adjusted input

Example

Listing 98 Example function call limit the input (saturation)
1#include "uz_signals.h"
2int main(void) {
3   float input = 2.0f;
4   float upper_limit = 0.5f;
5   float lower_limit = 0.2f;
6   float output = uz_signals_saturation(input, upper_limit, lower_limit);
7}

Description

Limits an input signal to the specified upper and lower saturation values.

Figure made with TikZ

Fig. 74 saturation wave