필터 지우기
필터 지우기

Why normalize function has a different result on a matrix vs single value?

조회 수: 2 (최근 30일)
I have a matrix like:
B=[ 1.5035; 1.5728; 1.6485; 1.5369; 1.5467; 1.572; 1.5374; 1.787; 1.5825; 1.6905];
Using normalize function like normalize(B,'range') has this result:
ans = 0
0.24444
0.51146
0.11781
0.15238
0.24162
0.11958
1
0.27866
0.65961
But when I use it for a single value like normalize(B(2,:),'range') the result is 0 but the result for row number 2 in ans is 0.24444, why its different and how can I fix it?

채택된 답변

Walter Roberson
Walter Roberson 2020년 3월 8일
normalize subtracts the minimum, and divides by the difference between the minimum and maximum. When there are only finite values and two or more different values, the minimum maps to 0 and the maximum maps to 1.
When you only pass in values that are all the same, then after you subtract off the minimum what is left is only 0.
normalize always depends on the entire set of input values. It does not do any kind of absolute normalization that would work on a single value at a time.
Perhaps you want a mapping such as zscore under the assumption of mean 0 standard deviation 1.

추가 답변 (1개)

the cyclist
the cyclist 2020년 3월 8일
편집: the cyclist 2020년 3월 8일
Your question perplexes me.
In general, the scaling parameters for normalization can depend on every input value in the vector. In the case of the range method, they depend on the minimum and maximum values of the vector. For example, when you normalize your vector B, the result is effectively
normalized_B = (B - min(B)) ./ (max(B)-min(B));
In other words, you subtract the smallest value of B, to get the minimum of the new interval to be 0, and then divide by the range, to get the maximum of the new interval to be 1.
I'm not even sure what to expect for a range normalization of a single value. I think I would have expected NaN.
So, my question is why would you expect the output to be the same? I think this function simply doesn't do the operation you expect it to.

카테고리

Help CenterFile Exchange에서 Hypothesis Tests에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by