probOfStreak

버전 1.0.0.0 (2.3 KB) 작성자: Jeff Evans
Calculate the probability of a run or streak of K consecutive successes in N Bernoulli trials.
다운로드 수: 360
업데이트 날짜: 2013/1/4

라이선스 보기

% RESULT = PROBOFSTREAK(N, K, P)
% Function to calculate the probability of getting a run or streak of K
% consecutive successes in N Bernoulli trials with probability P. Stated
% otherwise, this calculates the probability of a run or streak of K
% consective heads in N independent coin tosses. N and K are integers where
% N>=0, K>0, and 0<=P<=1.
%
% EXAMPLES:
% Calculate the probability of observing 4 consective heads (successes)
% during 10 coin tosses (trials) using a fair coin (P=0.5):
% result = probOfStreak(10,4,0.5);
%
% Calculate the probability of observing 4 consective heads (successes)
% during 10 coin tosses (trials) using an unfair coin that lands on heads
% 60% of the time (P=0.6):
% result = probOfStreak(10,4,0.6);
%
%
% Algorithm adapted from Javascript code embedded here:
% http://maxgriffin.net/CalcStreaks.shtml
%
% which is an adaptation of the algorithm originally described here:
% http://www.askamathematician.com/2010/07/q-whats-the-chance-of-getting-a-run-of-k-successes-in-n-bernoulli-trials-why-use-approximations-when-the-exact-answer-is-known/
%
% Jeffrey Evans
% January 3, 2012

인용 양식

Jeff Evans (2024). probOfStreak (https://www.mathworks.com/matlabcentral/fileexchange/39713-probofstreak), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2010b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0