Limit a vector value
8 次查看(过去 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!