How to restrict the range ?
Mostrar comentarios más antiguos
I want to restrict the output of the arc cosine to be in the range [-1,1], but I want to know if there is built-in Matlab function for this task and if it is possible for example merge @max & @min simultaneoulsy in the function bsxfun to achieve this task.
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 3 de Mzo. de 2016
min(max(x, -1), 1)
2 comentarios
Susan Arnold
el 3 de Mzo. de 2016
Editada: Susan Arnold
el 3 de Mzo. de 2016
Jos (10584)
el 4 de Mzo. de 2016
Simply replace -1 and 1 by the minimum and maximum of B
... max(A,min(B(:))) ...
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!