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

    %% Compare Student's _t_ and Normal Distribution pdfs
%

% Copyright 2015 The MathWorks, Inc.


%%
% Compute the pdf for a Student's _t_ distribution with parameter |nu = 5|,
% and for a standard normal distribution.
x = -5:0.1:5;
y = tpdf(x,5);
z = normpdf(x,0,1);

%%
% Plot the Student's _t_ and standard normal pdfs on the same figure. The
% standard normal pdf (dashed line) has shorter tails than the Student's
% _t_ pdf (solid line).
figure;
plot(x,y,'-',x,z,'-.')