How can I map data from [min1 max1] into [min2 max2]?

2 ビュー (過去 30 日間)
K M Ibrahim Khalilullah
K M Ibrahim Khalilullah 2018 年 2 月 2 日
回答済み: Akira Agata 2018 年 2 月 2 日
I have an array data as for example : [ .3 .5 .8 .1 0], where min1=0 and max1=0.8. Now I would like to map the into the another range where min2=0 and max2=500.

採用された回答

Akira Agata
Akira Agata 2018 年 2 月 2 日
You can use interp1 function, like:
r1 = [0 0.8]; % Input range
r2 = [0 500]; % Output range
vIn = [0.3 0.5 0.8 0.1 0]; % Your vector
vOut = arrayfun(@(x) interp1(r1,r2,x),vIn);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Segmentation and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by