How map values of array to 0 and 1

40 ビュー (過去 30 日間)
Eleanor Lee
Eleanor Lee 2019 年 12 月 6 日
回答済み: Jeremy 2019 年 12 月 6 日
How can i write a function such that it takes an array, and outputs an array of same size with values lying in [0,1] but also that the largest value is mapped to 1, and smallest to 0?

回答 (2 件)

Jeremy
Jeremy 2019 年 12 月 6 日
normalized_array = normalize(array,'range',[0 1]);

Guillaume
Guillaume 2019 年 12 月 6 日
It's trivial normalisation. Subtract the minimum of your array so the new minimum is 0, then divide by the max of that new array so the max becomes 1.

カテゴリ

Help Center および File ExchangeData Types についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by