I need this MATLAB question answered ASAP thanks in advance
I need this MATLAB question answered ASAP!!! thanks in advance!
10 Write a program which prompts the user for data and returns the mean. The code should execute the following steps: 1) Prompts the user to enter the number of observations 2) Use a FOR-LOOP to get data from user. At each iteration, the user is asked for value of the i-th observation 3) At each iteration, print the mean of the sample up to and including the i-th observation to the screen. 0 pointsSolution
For Part A
-----------------------------------------------
function out = repeatedMean()
total = input(\'Iput the total number of observatioons\');
sum = 0;
for m = 1:total
statement1 = sprintf(\'enter your %d observation\',m);
num = input(statement);
sum += num;
mean = (sum / m);
statement2 = sprintf(\'mean till %d th observation is %f\',m,mean);
disp(statement2);
end
end
Part B , conversion from fahrenhiet to celcius
----------------------------------------------------
function out = fahrenhietToCelcius()
disp(\'This program convert Fahrenheit to celcius\');
Faren=input(\'Write a temperature in Farenheit and you\'\'ll have the result in Celcius: \');
disp([ \'x = \' num2str(Faren) \' Fahrenheit and y = \' num2str((Faren-32)/1.8) \' Celcius \' ]);
end
