How to type saturation command in MatLab?

I got a plant and a controller which controlling the plant. Before the control signals go into the plant transfer function,it have to pass through saturation +-0.1. We can do this easily in Simulink by dragging and make used of the saturation function block. Instead of using the Simulink, do anyone know how to type the saturation command in Matlab command window?

 採用された回答

Walter Roberson
Walter Roberson 2012 年 2 月 25 日
編集済み: Arkadiy Turevskiy 2024 年 6 月 19 日

8 投票

saturated_x = min(0.1, max(-0.1, x));
Edit by Arkadiy Turevskiy from MathWorks on 6/19/2024.
You could do it in MATLAB but I would recommend modeling nonlinear control systems, including control saturation effects in Simulink. Simulink was designed to make modeling and simulation of such systems easy. In MATLAB you would need to write code that would solve ordinary differential equations describing dynamics of your plant and your controller one time step at a time. You would have to write ODE solver yourself using a for loop, or you can use ode45 function in MATLAB and write your own implementation of odefun argument that would have to account for saturation.

4 件のコメント

Yuki Wong
Yuki Wong 2012 年 2 月 25 日
Hi Walter Roberson,
What should be the 'x'?
For instance, i got a plant transfer function Gp=1/(s+1), Controller Gc=1/(s+2)
How should i type for the system in closed loop with saturation?
Thankyou very much.
Walter Roberson
Walter Roberson 2012 年 2 月 25 日
x is whatever variable you want to have saturated.
I have not studied control theory so I do not know how to convert your transfer functions in to time based signals.
You might need to decide (potentially) whether the saturation needs to apply to every step of the calculation, or only to the final result. This would approximately correspond to the question of whether "transients" need to be dampened at every step or whether only the final answer is important.
Utkarsh Anand
Utkarsh Anand 2018 年 5 月 9 日
You can convert a transfer function into a time signal using 'lsim' in matlab.
雨升 杨
雨升 杨 2022 年 4 月 8 日
Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by