フィルターのクリア

Scale/Normalize values in matrix between 10^-6 and 10^-5

1 回表示 (過去 30 日間)
stelios loizidis
stelios loizidis 2023 年 4 月 12 日
コメント済み: stelios loizidis 2023 年 4 月 12 日
Hello,
I have a matrix Data (90X150) and I want its values to be normalized. I wrote the code below:
% Normalization
min_Data = min(Data,[],2); % min for each row
max_Data = max(Data,[],2); % max for each row
Data_Norm=(Data - min_Data)./(max_Data- min_Data);
Based on the above code, the normalization is done between 0-1, but I want the normalization to be done between 10^-6 and 10^-5. How is this done? Your help is valuable.

採用された回答

Askic V
Askic V 2023 年 4 月 12 日
編集済み: Askic V 2023 年 4 月 12 日
Hello,
this is a matter of a simple linear transformation y = m*x+n.
if you want to normalize data in interval [a,b] to interval [c,d], then the following code would work:
x = [-1 2 4 0 5 6] % input data
x = 1×6
-1 2 4 0 5 6
a = min(x);
b = max(x);
c = 3; % new interval limit
d = 4; % new interval limit
m = (d-c)/(b-a);
n = (c*b-d*a)/(b-a);
y = m*x+n
y = 1×6
3.0000 3.4286 3.7143 3.1429 3.8571 4.0000
Of course, the most preffered way is to use built in functions:
x = [-1 2 4 0 5 6] % input data
x = 1×6
-1 2 4 0 5 6
c = 3; % new interval limit
d = 4; % new interval limit
y2 = rescale (x,c,d) % rescaled data
y2 = 1×6
3.0000 3.4286 3.7143 3.1429 3.8571 4.0000
  1 件のコメント
stelios loizidis
stelios loizidis 2023 年 4 月 12 日
Okay. Thank you for your help!!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraph and Network Algorithms についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by