s1rout1.m
来自「Industrial Mathematics」· M 代码 · 共 15 行
M
15 行
% Routine 1.1p = 1/3; % one in three volunteers show upfor n=60:80 % start with 60 calls pk = (1-p)^n; % this is p(0)
sum = 0; % initialize the sum for k=1:19 % recursively compute p(19) pk = (n-k+1)*p*pk/k/(1-p); % p(k) from p(k-1) sum = sum + pk; % sum terms end; % summation complete for this nE(n) = sum; % tabulate summationsend; % tried up to 80 callsplot(E) % graph falls below .1?
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?