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

    %% Compute Noncentral _F_ Distribution pdf
%

% Copyright 2015 The MathWorks, Inc.


%%
% Compute the pdf of a noncentral _F_ distribution with degrees of freedom
% |NU1 = 5| and |NU2 = 20|, and noncentrality parameter |DELTA = 10|. For
% comparison, also compute the pdf of an _F_ distribution with the same
% degrees of freedom.
x = (0.01:0.1:10.01)';
p1 = ncfpdf(x,5,20,10);
p = fpdf(x,5,20);

%%
% Plot the pdf of the noncentral _F_ distribution and the pdf of the _F_
% distribution on the same figure.
figure;
plot(x,p1,'b-','LineWidth',2)
hold on
plot(x,p,'g--','LineWidth',2)
legend('Noncentral F','F distribution')