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

    %% Compute Noncentral _t_ Distribution pdf
%

% Copyright 2015 The MathWorks, Inc.


%%
% Compute the pdf of a noncentral _t_ distribution with degrees of freedom
% |V = 10| and noncentrality parameter |DELTA = 1|. For comparison, also
% compute the pdf of a _t_ distribution with the same degrees of freedom.
x = (-5:0.1:5)';
nct = nctpdf(x,10,1);
t = tpdf(x,10);

%%
% Plot the pdf of the noncentral _t_ distribution and the pdf of the _t_
% distribution on the same figure.
plot(x,nct,'b-','LineWidth',2)
hold on
plot(x,t,'g--','LineWidth',2)
legend('nct','t')