Is there any function in matlab just like 'saturation' block in simulink? Which limit a input value within a range. If it exceeds the upper value it sets to the upper value and same for lower value.

답변 (2개)

dpb
dpb 2014년 3월 26일

8 개 추천

Not builtin but it's simple enough to create...
function y = bound(x,bl,bu)
% return bounded value clipped between bl and bu
y=min(max(x,bl),bu);

댓글 수: 1

Fahad Mirza
Fahad Mirza 2014년 3월 26일
Ah...thanks! Sometimes the easy solution just don't come into the mind! ~sigh~
:)

댓글을 달려면 로그인하십시오.

Erik Newton
Erik Newton 2024년 8월 29일

1 개 추천

Since R2024a, there is now a clip function.

카테고리

도움말 센터File Exchange에서 Simulink Functions에 대해 자세히 알아보기

질문:

2014년 3월 25일

편집:

2024년 8월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by