Write a function called normalizeGrades that receives a row array of test scores of arbitrary length and positive values, and produces two outputs: A row array array containing the grades normalized to a linear scale from 0 to 100 (i.e. grades are normalized if the maximum grade equals 100). Hint: Use the internal function max. The average of the normalized grades. Hint: Use the internal function mean. Restriction: Loops may not be used. For example, following code: scores=[90, 45, 76, 21, 85, 97, 91, 84, 79, 67]; [normScores,average]=normalizeGrades(scores) produces: normScores=[92.78, 46.39, 78.35, 21.65, 87.63, 100, 93.81, 86.6, 81.44, 69.07] average= 75.77 Function Save Reset MATLAB DocumentationOpens in new tab function [ output_args ] = untitled( input_args ) % Takes a row array of test scores (arbitrary length, and positive values) % and produces two outputs: % grades: A row array grades containing normalized grades scores on a linear scale from 0 to 100. % average: A numeric number equaling the average of the normalized scores. % end 1 2 3 4 5 6 7 8 9 Code to call your function Reset % test dataset, use randi to generate others scores=[90, 45, 76, 21, 85, 97, 91, 84, 79, 67]; [ normScores, average ] = normalizeGrades( scores ) 1 2 3 Run Function

Respuesta :

Answer:

function [normScores, average] = normalizeGrades(scores)

 

   m=max(scores);

   normScores=(scores./m)*100;

   average=mean(normScores);

end

scores = [90, 45,76,21,85,97,91,84,79,67];

[normScores, average] = normalizeGrades(scores)

Explanation:

  • Normalize the given scores to a linear scale from 0 to 100  and find the average of normalized scores .
  • Find the maximum score in the given scores  and normalize each score, using the maximum score, between 0 to 100 .
  • Find the average of normalized scores using mean .
  • Test the data set .