Continuous event probability table

Continuous event probability chart with two different colors balls, cards or different objects
23 Downloads
Updated 6 Aug 2017

View License

% f_tabpro - all convinations possible to draw consecutively from the box
% with x balls ,number card or other object and y numbers of the
% complemente object
% (z) times . The box have x balls and y balls with 2 diferents color.
% [ omp,omm ] = f_tabpro( x, y, z) where x and y are non-negative integers
% and number of total balls of diferentes colors
% z is the number times of we draw balls from the box consecutively .
% omp is probability table for consecutive acctions
% omn is the convinations table of darw balls ,
% 1 = firts color or ases in deck of cards
% 0 = the other color or the rest of the deck of cards

%
% Examples:
% [ omp,omn] = f_tabpro( 2,3,3)
% omp =
% 0.6000 0.5000 0.3333
% 0.4000 0.7500 0.6667
% 0.6000 0.5000 0.6667
% 0.6000 0.5000 0.6667
% 0.4000 0.2500 1.0000
% 0.4000 0.7500 0.3333
% 0.6000 0.5000 0.3333
%
% omn =
% 0 0 0
% 1 0 0
% 0 1 0
% 0 0 1
% 1 1 0
% 1 0 1
% 0 1 1

% usefull sample in deck of cards sample
%%
% In a deck of 20 cards( 1,1,2,2,3,3,4,4........9,9,10,10) we choose 3 cards and have now a deck whit 15 cards,
% What is the probability of getting an ace ("1") in the first attempt in this 15 remaining cards

% total =20 cards....
% x= 2 ACE
% y= 18 no ACE , the rest
% total darw card 3 + last one = 4
% z=4;

%[ omp,omm ] = f_tabpro( 2,18,4)
% omp =
%
% 0.9000 0.8947 0.8889 0.8824
% 0.1000 0.9474 0.9444 0.9412
% 0.9000 0.1053 0.9444 0.9412
% 0.9000 0.8947 0.1111 0.9412
% 0.9000 0.8947 0.8889 0.1176
% 0.1000 0.0526 1.0000 1.0000
% 0.1000 0.9474 0.0556 1.0000
% 0.1000 0.9474 0.9444 0.0588
% 0.9000 0.1053 0.0556 1.0000
% 0.9000 0.1053 0.9444 0.0588
% 0.9000 0.8947 0.1111 0.0588

% omm =
%
% 0 0 0 0->
% 1 0 0 0->
% 0 1 0 0->
% 0 0 1 0->
% 0 0 0 1->
% 1 1 0 0->
% 1 0 1 0->
% 1 0 0 1->
% 0 1 1 0->
% 0 1 0 1->
% 0 0 1 1->

% file 1.... 0 0 0 0 = 0.9000 * 0.8947 * 0.8889 * 0.8824 = 06316
% file 2......1 0 0 0 = 0.1000 * 0.9474 * 0.9444 * 0.9412 =0.0842
% file.....
% ..
% ..
% file 11... 0 0 1 1 = 0.9000 * 0.8947 * 0.1111 * 0.0588= 0.0053
%
% SUM res=06316+0.0842+...... ......+0.0053 = 1
% What is the probability of getting an ace ("1") in the first attempt in this 15
% remaining cards = SUM of Prod File prob where last number is 1

% See the table
% Last4 =0 Last4= 1,
% ----------------------
% 0 0 0 0 Prob-> 0.9000 * 0.8947 * 0.8889 * 0.8824 = 0.6316 0.6316
% 1 0 0 0 Prob-> 0.1000 * 0.9474 * 0.9444 * 0.9412 = 0.0842 0.0842
% 0 1 0 0 Prob-> 0.9000 * 0.1053 * 0.9444 * 0.9412 = 0.0842 0.0842
% 0 0 1 0 Prob-> 0.9000 * 0.8947 * 0.1111 * 0.9412 = 0.0842 0.0842
% 0 0 0 1 Prob-> 0.9000 * 0.8947 * 0.8889 * 0.1176 = 0.0842 - 0.0842
% 1 0 1 0 Prob-> 0.1000 * 0.0526 * 1.0000 * 1.0000 = 0.0053 0.0053
% 1 0 1 0 Prob-> 0.1000 * 0.9474 * 0.0556 * 1.0000 = 0.0053 0.0053
% 1 0 0 1 Prob-> 0.1000 * 0.9474 * 0.9444 * 0.0588 = 0.0053 - 0.0053
% 0 1 1 0 Prob-> 0.9000 * 0.1053 * 0.0556 * 1.0000 = 0.0053 0.0053
% 0 1 0 1 Prob-> 0.9000 * 0.1053 * 0.9444 * 0.0588 = 0.0053 - 0.0053
% 0 0 1 1 Prob-> 0.9000 * 0.8947 * 0.1111 * 0.0588 = 0.0053 - 0.0053
% ---------------------------------------------------------------------------------------------
% ----------------------------------------------- SUM>= 1.0000 0.9000 0.1000

%%
% use the function
% f_true_table( x,y,z); By Aldo Tamariz aldotb@gmail.com

% for Matlab R2016a

% (c) Aldo Tamariz B
% email: aldotb@gmail.com

Cite As

Aldo Tamariz B (2024). Continuous event probability table (https://www.mathworks.com/matlabcentral/fileexchange/64022-continuous-event-probability-table), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2016a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Images in Help Center and MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes
1.0.0.0