Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

RMS Average The root-mean-square (rms) average is another way of calculating a m

ID: 3761614 • Letter: R

Question

RMS Average The root-mean-square (rms) average is another way of calculating a mean for a set of numbers. The rms average of a series of numbers is the square root of the arithmetic mean of the squares of the numbers: (4-17) Write a MATLAB program that will accept an arbitrary number of positive input values and calculate the rms average of the numbers. Prompt the user for the number of values to be entered and use a for loop to read in the numbers. Test your program by calculating the rms average of the four numbers 10, 5, 2, and 5. It is a script for matlab

Explanation / Answer

MATLAB Script:

Sample output:

Enter the total values: 4

Enter the value: 10

Enter the value: 5

Enter the value: 2

Enter the value: 5

The rms average for the set of numbers is 6.2048

Code to Copy:

total = 0;

nvals = input('Enter the total values: ');

for jj = 1:nvals

a = input('Enter the value: ');

total = total + a^2;

end

rms_average = sqrt( total / nvals );

fprintf('The rms average for the set of numbers is %.4f ',rms_average);