How can normalize matrix in range [-1,1]?

2 ビュー (過去 30 日間)
mohammed mahmoud
mohammed mahmoud 2018 年 4 月 18 日
編集済み: KSSV 2018 年 4 月 18 日
the matrix have dimension 8192*51975 contains positive and negative values

採用された回答

Matt Macaulay
Matt Macaulay 2018 年 4 月 18 日

Divide the matrix by it's largest absolute value. For example, take the matrix:

A = 200*(.5-rand(3))

Now normalise it:

A = A/max(max(abs(A)))

その他の回答 (1 件)

KSSV
KSSV 2018 年 4 月 18 日
編集済み: KSSV 2018 年 4 月 18 日

To normalize between the limits [r0,r1] i.e [-1,1]. Do the following:

r0 = -1 ; r1 = +1 ;
% First normalize to [0 ,1] 
a = rand(10,1) ;
range = max(a) - min(a);
a = (a - min(a)) / range;
% Then scale to [-1,1]
range2 = r1-r0;
a = (a * range2) + r0;

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by