Code covered by the BSD License  

Highlights from
Chapter 1 Exercises of Introduction to Probability

image thumbnail

Chapter 1 Exercises of Introduction to Probability

by

 

Matlab Implementation of Introductory Probability

cointosses.m
%CoinTosses
clc;clear all;close all;
tosses=linspace(100,10000,100);

for i=1:size(tosses,2)
    out=rand(1,tosses(i));
    heads(i)=sum(out<0.5)/tosses(i);
end

plot(tosses,heads);grid;
xlabel('Number of tosses');ylabel('Percentage of heads');
title('Coin Toss Experiment');

Contact us