www.gusucode.com > stats 源码程序 matlab案例代码 > stats/ZTestForAHypothesizedMeanExample.m

    %% z-Test for a Hypothesized Mean  

%% 
% Load the sample data. Create a vector containing the first column of the
% students' exam grades data. 
load examgrades
x = grades(:,1);  

%% 
% Test the null hypothesis that the data comes from a normal distribution
% with mean |m = 75| and standard deviation |sigma = 10|. 
[h,p,ci,zval] = ztest(x,75,10) 

%%
% The returned value of |h = 0| indicates that |ztest| does not reject the
% null hypothesis at the default 5% significance level.