function IEOR161HW7 - hist(x(i,:),25); end %% histogram for...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function IEOR161HW7() clear all clc close all %% histograms for birth-death process u = .35; d = .55; t = [5,10,20,50,75,100,200]; x = zeros(length(t),10000); for i = 1:length(t); for j = 1:10000; y=0; for k = 1:t(i); p = rand; y = y + (p<u) - (p>(1-d)&y>0); end x(i,j)= y; end figure(t(i));
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: hist(x(i,:),25); end %% histogram for geometric RV with success probability p = 1-(u/d) p = 1-(u/d); count = zeros(1,10000); for i = 1:10000; wait = 0; while rand&gt;p; wait = wait + 1; end count(i) = wait; end figure(8); hist(count,50); end...
View Full Document

This note was uploaded on 03/17/2011 for the course IEOR 161 taught by Professor Lim during the Spring '08 term at University of California, Berkeley.

Ask a homework question - tutors are online