You are given a vector of test scores and wish to normalize these scores by comp
ID: 3550585 • Letter: Y
Question
You are given a vector of test scores and wish to normalize these scores by computing a new vector, normTests, which will contain the test scores on linear scale from 0 to 100. A zero still corresponds to a zero, and the highest test score will correspond to 100.
For example, tests = [90 45 76 21 85 97 91 84 79 67 76 72 89 95 55];
normTests should be [92.78 46.39 78.35 21.65 87.63 100 93.81 86.6 ... 81.44 69.07 78.35 74.23 91.75 97.94 56.7]; Do not use any MATLAB functions except input() and length(). Calculate the normalized scores by dividing each score by the highest score.
Explanation / Answer
%Write a MATLAB script that, when given a vector of numbers, nums, creates a vector newNums containing every other element of the original vector,
%starting with the first element. For example, nums = [6 3 56 7 8 9 445 6 7 437 357 5 4 3] newNums should be [6 56 8 445 7 357 4].
%Use the for loop instead and Do not use any MATLAB functions except input() and length().
nums = input('Enter a vector of numbers');
newNums = [];
for i=1:2:length(nums)
newNums = [newNums nums(i)];
end
newNums
%You are given a vector of test scores and wish to normalize these scores by computing a new vector, normTests, which will contain the
%test scores on linear scale from 0 to 100. A zero still corresponds to a zero, and the highest test score will correspond to 100.
%For example, tests = [90 45 76 21 85 97 91 84 79 67 76 72 89 95 55];
%normTests should be [92.78 46.39 78.35 21.65 87.63 100 93.81 86.6 ... 81.44 69.07 78.35 74.23 91.75 97.94 56.7];
%Do not use any MATLAB functions except input() and length(). Calculate the normalized scores by dividing each score by the highest score.
tests = input('Enter a vector of test scores');
max = tests(1);
for i=2:length(tests)
if tests(i)>max max = tests(i);
end
end
normTests = (tests./max).*100;
normTests
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.