Process matrices by mapping row minimum and maximum values
to [1 1
]
[Y,PS] = mapminmax(X,YMIN,YMAX)
[Y,PS] = mapminmax(X,FP)
Y = mapminmax('apply',X,PS)
X = mapminmax('reverse',Y,PS)
dx_dy = mapminmax('dx_dy',X,Y,PS)
mapminmax
processes matrices by normalizing
the minimum and maximum values of each row to [YMIN
, YMAX
].
[Y,PS] = mapminmax(X,YMIN,YMAX)
takes X
and
optional parameters
X 

YMIN  Minimum value for each row of 
YMAX  Maximum value for each row of 
and returns
Y 

PS  Process settings that allow consistent processing of values 
[Y,PS] = mapminmax(X,FP)
takes parameters
as a struct: FP.ymin
, FP.ymax
.
Y = mapminmax('apply',X,PS)
returns Y
,
given X
and settings PS
.
X = mapminmax('reverse',Y,PS)
returns X
,
given Y
and settings PS
.
dx_dy = mapminmax('dx_dy',X,Y,PS)
returns
the reverse derivative.
Here is how to format a matrix so that the minimum and maximum
values of each row are mapped to default interval [1,+1
].
x1 = [1 2 4; 1 1 1; 3 2 2; 0 0 0] [y1,PS] = mapminmax(x1)
Next, apply the same processing settings to new values.
x2 = [5 2 3; 1 1 1; 6 7 3; 0 0 0] y2 = mapminmax('apply',x2,PS)
Reverse the processing of y1
to get x1
again.
x1_again = mapminmax('reverse',y1,PS)
It is assumed that X
has only finite real
values, and that the elements of each row are not all equal. (If xmax=xmin
or
if either xmax
or xmin
are nonfinite,
then y=x
and no change occurs.)
y = (ymaxymin)*(xxmin)/(xmaxxmin) + ymin;