%密度函數
x1=-1:0.01:4;
y1=unifpdf(x1,0,3); %均勻分佈
x2=-5:0.001:5;
y2=normpdf(x2,0,1); %正態分佈
x3=0:0.001:10;
y3=exppdf(x3,3); %指數分佈
x4=-5:0.01:25;
y4=binopdf(x4,1000,0.01); %二項分佈
x5=0:0.001:10;
y5=geopdf(x5,0.25); %幾何分佈
x6=-10:50;
y6=poisspdf(x6,10); %泊松分佈
subplot(2,3,1);plot(x1,y1);title('均勻分佈(a=0,b=3)');
subplot(2,3,2);plot(x2,y2);title('標準正態分佈');
subplot(2,3,3);plot(x3,y3);title('指數分佈(B=3)');
subplot(2,3,4);plot(x4,y4);title('二項分佈(n=1000,p=0.01)');
subplot(2,3,5);plot(x5,y5);title('幾何分佈(p=0.25)');
subplot(2,3,6);plot(x6,y6);title('泊松分佈(入=10)');
密度函數圖如下: