Answer on Question #45300, Programming, Mat LAB | Mathematica | MathCAD | Maple
Question:
Write a script averages which take two values xlow and xhigh and generate 10000 random numbers in the range [xlow...xhigh], and calls the appropriate functions to compute arithmetic mean (average), rms average, geometric mean and harmonic mean.
Answer:
function [average_value, rms_value, geometric_mean, harmonic_mean] = averages(xlow, xhigh)
random_array = random('unif', xlow, xhigh, 10000, 1);
average_value = mean(random_array);
rms_value = rms(random_array);
geometric_mean = geomean(random_array);
harmonic_mean = harmmean(random_array);
endhttp://www.AssignmentExpert.com/
Comments