Question #45477

Matlab: Write a single program that calculates the arithmetic mean (average), rms average, geometric mean and harmonic mean for a set of n positive numbers. Your program should take two values xlow and xhigh and generate 10000 random numbers in the range [xlow…xhigh], and should print out arithmetic mean (average), rms average, geometric mean and harmonic mean.
1

Expert's answer

2014-09-08T07:05:28-0400

Here is the processed document with the code block restored and formatted:

Answer on Question #45477, Programming, Mat LAB | Mathematica | MathCAD | Maple

Question:

Matlab: Write a single program that calculates the arithmetic mean (average), rms average, geometric mean and harmonic mean for a set of n positive numbers. Your program should take two values xlow and xhigh and generate 10000 random numbers in the range [xlow...xhigh], and should print out arithmetic mean (average), rms average, geometric mean and harmonic mean.

Answer:

File average_values.m:


function [] = average_values(xlow, xhigh)
    random_numbers = random('unif', xlow, xhigh, 10000, 1);
    arithmetic_mean = mean(random_numbers);
    rms_average = rms(random_numbers);
    geometric_mean = geomean(random_numbers);
    harmonic_mean = harmmean(random_numbers);
end


http://www.AssignmentExpert.com/

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!
LATEST TUTORIALS
APPROVED BY CLIENTS