## Normalize/scale in range

Pete

### Pete (view profile)

さんによって質問されました 2019 年 10 月 16 日

### Kaashyap Pappu (view profile)

さんによって 回答されました 2019 年 10 月 21 日
Kaashyap Pappu

### Kaashyap Pappu (view profile)

さんの 回答が採用されました
hi all,
I would like to normalize values in a 18x17 matrix to have values between -1 and 1.
I would also like to be able to say that 0 = 76 mm, -1 = 71 mm, 1 = 81 mm for example instead of just using the min and max values in the array.
Any help would be greatly appreciated!

dpb

### dpb (view profile)

2019 年 10 月 16 日
You can't do both unless the min/max are <= the chosen min/max.
NB: if you do choose the above three points the scaling between negative and positive results will be skewed by a significant amount -- double, in fact.
But, it's simply solving for the linear coefficients between the two...or you could use interp1

サインイン to comment.

## 1 件の回答

### Kaashyap Pappu (view profile)

2019 年 10 月 21 日
採用された回答

The code below can help perform matrix normalization where you have to specify the appropriate -1, 0 and 1 values in variables "pointZero", "pointPositive" and "pointNegative". Any value lower than -1 is set to -1 and any value greater than one is set to 1.