bulb.m
来自「一些常被用于教学或者参考的概率论的实例的源代码」· M 代码 · 共 19 行
M
19 行
%bulb.m/created by PJNahin for "Duelling Idiots"(5/9/98)
%This m-file calculates and plots the probability of a bulb,
%wired in series/parallel with sheets of switches, glowing.
%
%
n=input('Number of switches in a row? ')
for p=1:200
r=p/200;
P1(p)=(1-(1-r^n)^n)^n;
P2(p)=1-((1-r^n)^(n*n));
end
r=.005:.005:1;
plot(r,P1,'-',r,P2,'.')
grid
title('Fig.3.4-Solid Line for Series Sheets, Dots for Parallel Sheets')
xlabel('probability, p, an individual switch is closed')
ylabel('probability bulb glows, P(10,p)')
figure(1)
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?