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 !

2 comentarios

madhan ravi
madhan ravi el 8 de Ag. de 2020
What?
Amal Ashoor
Amal Ashoor el 8 de Ag. de 2020
I have a vector of undetermined varaibles (V). Each varaible have an upper and lower bound. For example, the first component in vector V is x where x value is between 0.1 and 10. So, how can I write this?

Iniciar sesión para comentar.

 Respuesta aceptada

Fangjun Jiang
Fangjun Jiang el 8 de Ag. de 2020

0 votos

>> min([1 2 3],[2 0 5])
ans =
1 0 3
also see max()

3 comentarios

Amal Ashoor
Amal Ashoor el 8 de Ag. de 2020
Thank you for your response. However, I want to limit my variable not to find the maximum and minimum values in a vector.
Fangjun Jiang
Fangjun Jiang el 8 de Ag. de 2020
Editada: Fangjun Jiang el 8 de Ag. de 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
Amal Ashoor
Amal Ashoor el 8 de Ag. de 2020
Thanks!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Centro de ayuda y File Exchange.

Preguntada:

el 8 de Ag. de 2020

Comentada:

el 8 de Ag. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by