MATLAB QUESTION 1) Write a .m file that accepts a vector of data, and calculates
ID: 3598152 • Letter: M
Question
MATLAB QUESTION
1) Write a .m file that accepts a vector of data, and calculates the sample mean and sample standard deviation 2) write a m file that accepts a vector of data, and calculates a 95% CI of the mean of the data. 3) The data on the amount of whats produced at a small hydroplant are recorded in the csv file "hydro.csv" on blackboard. a)A local community is concerned that not enough power is being produced from the plant. If the town requires 18 Megawatts to maintain its power supply, perform a hypothesis to determine the test statistic for Ho : = 18 Megawatts.write a concluding statement regarding whether or not there is evidence to reject the hypothesis that the powerplant produces enough power b) compute a 95% confidence interval (either by hand or using your·m) of the average megawatts produced by the dam. State whether your confidence interval verifies the result of the hypothesis test from Q3a). Give reasoning as to how you came up with this statement.Explanation / Answer
%function to find mean and standard deviation:
function [mean,sdev]=MeanSdev(data)
n=numel(data);
s=0;
for i =1:n
s=s+data(i);
end
mean=s/n;
sqDiff=0;%squared difference sum
for i =1:n
a=(mean-data(i))^2;
sqDiff=sqDiff+a;
end
var=sqDiff/n;%variance
sdev=sqrt(var);
%function to find 95% confidence interval
function [upperL,lowerL]=CI95(data)
n=numel(data);
Mean=mean(data);
S=std(data);
Z=1.960;%for 95%
upperL=Mean+Z*(S/sqrt(n));
lowerL=Mean-Z*(S/sqrt(n));
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.