⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pois_d.m

📁 计量工具箱
💻 M
字号:
% PURPOSE: demo of poisson distribution functions
%          prints mean and variance of 1000 draws
%          plots pdf,cdf,inverse
% 
%---------------------------------------------------
% USAGE: pois_d
%---------------------------------------------------

n = 1000;
lam = 10;

tic;
tst = pois_rnd(n,lam);
toc;

% mean should equal lam
fprintf('mean should = %16.8f \n',lam);
fprintf('mean of draws = %16.8f \n',mean(tst));
fprintf('variance should = %16.8f \n',lam);
fprintf('variance of draws = %16.8f \n',std(tst)*std(tst));

tst = round(unif_rnd(n,1,20));
tsts = sort(tst);

pdf = pois_pdf(tsts,lam);
plot(tsts,pdf);
title('poisson pdf over 1 to 20 with mean=10');
pause;

cdf = pois_cdf(tsts,lam);
plot(tsts,cdf);
title('poisson cdf over 1 to 20 with mean=10');
pause;

pinv = pois_inv(cdf,lam);
plot(tsts,pinv);
title('poisson quantiles over 1 to 20 with mean=10');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -