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

    %% Fit a Generalized Extreme Value Distribution
% This example shows how to fit a generalized extreme value distribution to
% sample data.

% Copyright 2015 The MathWorks, Inc.


%% Fit a GEV to Maxima
blocksize = 1000;
nblocks = 250;
rng default  % For reproducibility
t = trnd(5,blocksize,nblocks);
x = max(t); % 250 column maxima
paramEsts = gevfit(x)

%% Plot the Data
histogram(x,2:20,'FaceColor',[.8 .8 1]);
xgrid = linspace(2,20,1000);
line(xgrid,nblocks*...
     gevpdf(xgrid,paramEsts(1),paramEsts(2),paramEsts(3)));