1

I have a range of values as [12,540 108 201,120 17] in an array.

I am going to convert these values in a range of [0 1] in MATLAB.

Is there any function in MATLAB?

4

3 回答 3

3

Check mapminmax function from Neural Network Toolbox.

With this function you can map you data into [YMIN YMAX] interval:

[Y,PS] = mapminmax(X,YMIN,YMAX)

It returns mapping parameters allowing you to use the same mapping with the new data:

Y = mapminmax('apply',X,PS)

or to revert the mapping to get your data back to the original space:

X = mapminmax('reverse',Y,PS)

But if you don't need to apply the same mapping twice or to revert it, then it's easier just to divide your data by the maximum value:

Y = (X - min(X)) / (max(X) - min(X))
于 2013-03-30T22:10:37.143 回答
1

Assuming all values are positive (as in your example) and the relationship between the variables in the original array and the [0 1] array is linear:

 x = [12,540 108 201,120 17];
 y = x/max(x);
于 2013-03-30T21:54:17.523 回答
-2
[Y,PS] = mapminmax(X,0,1)

Define your variable as x which can be matrix and use above comment in your code.

于 2016-01-15T16:38:08.020 回答