How to restrict the range ?
古いコメントを表示
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.
採用された回答
その他の回答 (1 件)
Walter Roberson
2016 年 3 月 3 日
min(max(x, -1), 1)
2 件のコメント
Susan Arnold
2016 年 3 月 3 日
編集済み: Susan Arnold
2016 年 3 月 3 日
Jos (10584)
2016 年 3 月 4 日
Simply replace -1 and 1 by the minimum and maximum of B
... max(A,min(B(:))) ...
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!