Chapter 1 Exercises of Introduction to Probability
by
Bilal Siddiqui
31 Jan 2011
Matlab Implementation of Introductory Probability

HorseRaces.m 
%HorceRaces
% Four horses (Acorn, Balky, Chestnut, and Dolby)have raced many times. It is
% estimated that Acorn wins 30 percent of the time,Balky 40 percent of the
% time, Chestnut 20 percent of the time, and Dolby 10 percent of the time
clc;clear all;close all;
races=1000;
out=rand(races,1);
%Acorn wins
Acorn=sum(out<0.3)/races*100
%Balky wins
Balky=sum(out>0.3 & out<0.7)/races*100
%Chestnut wins
Chestnut=sum(out>0.7 & out<0.9)/races*100
%Dolby wins
Dolby=sum(out>0.9)/races*100


Contact us