matlab将矩阵数据重新调整为-1到1
嗨,刚开始使用Matlab,我想知道如何重新调整矩阵中的数据。 我有一个 N 行 M 列的矩阵,想要将列中的数据重新调整为 -1 和 1 之间。
每列包含的值的范围从 0 - 10,000 到 0 到 1 之间的值,我想标准化为 -1 和 1 之间的原因是这些值将在神经网络中用作基于正弦的变换函数的输入值。
Possible Duplicate:
MATLAB: how to normalize/denormalize a vector to range [-1;1]
Hi, just started using Matlab and I would like to know how to rescale the data in a matrix.
I have a matrix of N rows by M columns and want to rescale the data in the columns to be between -1 and 1.
Each column contains values that vary in scale from say 0 - 10,000 to some that are between 0 and 1, the reason I want to normalise to between -1 and 1 as these values will be used in a Neural Network as input values for a transform function that is sine based.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
前面的答案都不正确。这就是您需要执行的操作:
矩阵
normalizedA
的值将介于-1
和1
之间。示例:
Neither of the previous answers are correct. This is what you need to do:
The matrix
normalizedA
will have values between-1
and1
.Example:
一个简单的解决方案将使用简单的逻辑。假设您打算独立缩放每个列,请执行以下操作:
显然,这将导致每列的最小值为 -1,最大值为 1。执行此操作的代码非常简单。
现在,执行上述 A 的步骤。
A simple solution would use simple logic. Assuming that you mean to scale EACH column independently, do this:
Clearly this will result in the min for each column to be -1, the max will be 1. Code to do so is simple enough.
Now, perform the steps above to A.