mapminmax的用法和实例详解

时间:2022-07-07 19:36:08

数据 x1 = [1 2 4],   x2 = [5 2 3]

[y, ps] = mapminmax(x1)     %归一化

y = –1.0000  -0.3333  1.0000

ps为结构体,内容是:

ps.name = ‘mapminmax’

ps.xrows = 1

ps.xmax = 4

ps.xmin = 1

ps.xrange = 3

ps.yrows = 1

ps.ymax = 1

ps.ymin = –1

ps.yrange = 2

转换规则:y = (ymax – ymin) * (x - xmin) / (xmax - xmin) + ymin

 

要对x2也应用同一种规则来规范化,即:

[y1, ps] = mapminmax(x1);

y2 = mapminmax(‘apply’, x2, ps)

 

反归一化:

xtt = mapminmax(‘reverse’, y1, ps);

 

-------参考文献:有关mapminmax的用法详解  by faruto