Limit a vector value
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Amal Ashoor
il 8 Ago 2020
Commentato: Amal Ashoor
il 8 Ago 2020
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 !
Risposta accettata
Fangjun Jiang
il 8 Ago 2020
>> min([1 2 3],[2 0 5])
ans =
1 0 3
also see max()
3 Commenti
Fangjun Jiang
il 8 Ago 2020
Modificato: Fangjun Jiang
il 8 Ago 2020
%%
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
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Structures in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!