how can normalize the data between 0 and 1??

조회 수: 2 (최근 30일)
ananthi thirupathi
ananthi thirupathi 2017년 2월 23일
댓글: Image Analyst 2019년 10월 20일
how can normalize the data between 0 and 1??(exclude 0 and 1)

답변 (2개)

Walter Roberson
Walter Roberson 2017년 2월 23일
mat2gray() would normalize to exactly 0 to exactly 1.
But what value do you want instead of 0? Should the smallest values be mapped to eps(realmin), which is about 1E-324 ?
  댓글 수: 3
Jan
Jan 2017년 2월 23일
@ananthi: Accepting an answer means, that the problem is solved. Then most readers will not care about the thread anymore. Is the problem solved?
Walter Roberson
Walter Roberson 2017년 2월 23일
mat2gray(DATA) * (1-eps) + eps(realmin)

댓글을 달려면 로그인하십시오.


Jan
Jan 2017년 2월 23일
편집: Jan 2017년 2월 23일
A cheap adjustment of the edges:
x = randn(100, 1);
xn = (x - min(x)) / (max(x) - min(x));
xn(xn == 0) = eps; % Or: eps(realmin)
xn(xn == 1) = 1 - eps;
Or consider the limits during the normalization: [EDITED, first version failed]
xmin = min(x);
xmax = max(x);
range = (xmax - xmin) + eps(xmax - xmin);
xn = (x - (xmin - eps(xmin))) / range;
% Or:
% xn = (x - (xmin - eps(xmax - xmin))) / range;
  댓글 수: 4
Sajitha K.N.
Sajitha K.N. 2019년 10월 20일
sir,what is this x?
Image Analyst
Image Analyst 2019년 10월 20일
It's the data that you want to rescale.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Geometric Geodesy에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by