?? exn561.m
字號:
%《MATLAB及其在理工課程中的應用指南》(十一五規劃版)第五章例5-6-1程序
% 幾種隨機變量的分布函數
% 西安電子科技大學出版社出版 陳懷琛編著 2007年7月
%
clear, close all
x1 = [-3:0.1:3]; % 標準正態分布隨機變量以概率95%集中在±3之間
f1 = normpdf(x1,0,1);
F1 = normcdf(x1,0,1);
subplot(2,2,1),plot(x1,f1,':',x1,F1,'-')
grid on, set(gcf,'color','w')
x2 = [0:0.1:20]; % 試探得出的范圍
f2 = chi2pdf(x2,10);
F2 = chi2cdf(x2,10);
line([-4,4],[0.025,0.025]),line([-4,4],[0.975,0.975]),
subplot(2,2,2),plot(x2,f2,':',x2,F2,'-')
grid on
x3 = [0:1:10]; % 二項式分布中離散隨機變量應為整數
f3 = binopdf(x3,10,0.2);
F3 = binocdf(x3,10,0.2);
line([0,20],[0.025,0.025]),line([0,20],[0.975,0.975]),
subplot(2,2,3),plot(x3,f3,':',x3,F3,'-'),grid on
line([0,10],[0.025,0.025]),line([0,10],[0.975,0.975]),
subplot(2,2,4),
stem(x3,f3,':'),
hold on
stairs(x3,F3,'-'),
line([0,10],[0.025,0.025]),line([0,10],[0.975,0.975]),
grid on
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -