Generate Random Number to Simulate

2 views (last 30 days)
Hanson Zhou
Hanson Zhou on 12 Oct 2015
Commented: Walter Roberson on 13 Oct 2015
Consider the following situation at a doctor’s office; On average, the patients will arrive at a rate of 5 patients per hour, and the doctor will spend on average 15 minutes on each patient. Doctor’s office opens at 9:00am, and by 3:00pm there will be 30 patients and it will take 7.5 hours to treat all of them. The office will close at 3:00pm, so whoever arrives after 3pm will be asked to come back another day, and those who arrives before 3 will be seen by the doctor. So the doctor expects to leave office at 4:30. (May be half an hour for lunch so the work day is from 9:00 to 5:00). However, these are only numbers on average.
Assume the time interval between arrival of 2 successive patients is exponentially distributed (βe−βx with µ = 1 β = 1 5 ), and the time spend with doctor is normally distributed (with µ = 1 4 and σ = 1 6 ).
(1) Generate random numbers to simulate a one day run, record the times of arrival and time of departure of each patient.
(2) Do this 10000 times, record the time the doctor leaves office for each run, plot the histogram of this final time. Compute the mean and the stardard deviation of this sample. This will be the pdf of how long the work day is.
Any idea? Thanks for helping.

Answers (0)

Categories

Find more on Random Number Generation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!