Limit a vector value
조회 수: 9 (최근 30일)
이전 댓글 표시
Hello!
I need help in limiting a variable vector (V) to lower limit (L) and upper limit (U) vectors, i.e. the value of the first variable in V is between L(1) and U(1). How I can do that?
Thanks in advance !
채택된 답변
Fangjun Jiang
2020년 8월 8일
>> min([1 2 3],[2 0 5])
ans =
1 0 3
also see max()
댓글 수: 3
Fangjun Jiang
2020년 8월 8일
편집: Fangjun Jiang
2020년 8월 8일
%%
L=[1 2 3];
U=[10 20 30];
V=[5 0 50];
NewV=min(max(L,V),U)
NewV =
5 2 30
Make sure there is no conflict between L and U
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Structures에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!