You are given a vector o开发者_运维知识库f test scores called tests, and wish to normalize these scores by computing a new vector, normTests, which will contain the test scores on a linear scale from 0 to 100. A zero will still correspond to zero, and the highest test score will correspond to 100. For example, if the highest score in the original data was 50, then all scores would be doubled.
I don't know MATLAB very well, but what you want to do is something like
normTests = (tests / max(tests))*100
Dividing the test scores by the maximum will produce a linear scale between 0 and 1, multiplying by 100 brings it back to 0 to 100
Multiply the vector by 100/x, where x is the maximum value in the vector.
精彩评论