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

    %% Compute the Extreme Value Distribution pdf
%
%%
% Compute the pdf of an extreme value distribution.

% Copyright 2015 The MathWorks, Inc.

t = [-5:.01:2];
y = evpdf(t);

%%
% Plot the pdf.
figure;
plot(t,y)

%%
% The extreme value distribution is skewed to the left, and its general
% shape remains the same for all parameter values. The location parameter,
% |mu|, shifts the distribution along the real line, and the scale
% parameter, |sigma|, expands or contracts the distribution.

%%
% The following plots the probability function for different combinations
% of |mu| and |sigma|.
x = -15:.01:5;
plot(x,evpdf(x,2,1),'-', ...
     x,evpdf(x,0,2),':', ...
     x,evpdf(x,-2,4),'-.');
legend({'mu = 2, sigma = 1', ...
        'mu = 0, sigma = 2', ...
        'mu = -2, sigma = 4'}, ...
       'Location','NW')
xlabel('x')
ylabel('f(x|mu,sigma)')