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.
close all; clear all; clc; N = 10000; xlow = input('Enter Xlow: '); xhigh = input('Enter Xhigh: '); if xhigh < xlow disp('Xhigh must be bigger then Xlow! Try again!') else X = xlow + (xhigh - xlow).*rand(1,N); X_m = sum (X)/N; X_rms = sqrt(sum (X.^2)/N); X_gm = prod(X.^(1/N)); X_hm = N/sum(1./X); disp(['Average of X = ', num2str(X_m)]); disp(['Root mean square of X = ', num2str(X_rms)]); disp(['Geometric mean of X = ', num2str(X_gm)]); disp(['Harmonic mean of X = ', num2str(X_hm)]); end
The moment you’ve entered the education system is the moment you start to realize that, although studying is extremely important,…
APPROVED BY CLIENTS
The services I have receive were remarkable. Everything was finished before the deadline and superseded my expectations as a first time user. I was honestly really nervous at first but now that I can trust Assignment Expert, I will definitely be utilizing it more and recommending friends as well! YOU ROCK