#### Question

A transportation engineering study requires that you determine the number of cars that pass through an intersection traveling during morning rush hour. You stand at the side of the road and count the number of cars that pass every 4 minutes at several times as tabulated below. Use the best numerical method to determine (a) the total number of cars that pass between 7:30 and 9:15, and (b) the rate of cars going through the intersection per minute.

$\begin{matrix}\text{Time (hr)} & \text{7:30} & \text{7:45} & \text{8:00} & \text{8:15} & \text{8:45} & \text{9:15}\\\text{Rate (cars}\\\text{per 4 min} & \text{18} & \text{23} & \text{14} & \text{24} & \text{20} & \text{9}\\\end{matrix}$

#### Solution

Verified#### Step 1

1 of 3$\textbf{a.)}$Since the time is given in hours, we need to convert rate of passing cars from (1/4 min) to (1/hour), and we do that by multiplying the second row of the given table by 60/4, or 15. Also, notice that the first row needs to be rewritten, for example: 7:30 is 7.5 hours and 7:45 needs to be written as 7.75, and so on. Hence, the data becomes as follows:

t=[7.5 7.75 8 8.25 8.75 9.25]; Nt=[18 23 14 24 20 9]*15;

Next, we apply Simpson's 1/3 for the first two segments from $t=7.5$ to $t=8$, and Simpson's 3/8 rule for the last three segments from $t=8$ to $t=9.25$, as shown in the MATLAB code below.

clear; clc; close all;
t=[7.5 7.75 8 8.25 8.75 9.25];
Nt=[18 23 14 24 20 9]*15;
m = length(t);
n=3;%For the 1/3 rule
n1=(Nt(1)+Nt(n));
n2=0;
n3=0;
for i=2:n-1
if rem(i,2)==0%checking if i is even
n2=n2+4*Nt(i);
else
n3=n3+2*Nt(i);
end
end
N1=(t(n)-t(1))*(n1+n2+n3)/(3*(n-1));

## %-Next, is the application of the 3/8 rule-%
N2=(t(m)-t(n))*(Nt(n)+3*Nt(n+1)+3*Nt(m-1)+Nt(m))/8;
N=N1+N2;
fprintf('The total number of cars is %0.3f\n',N);

The total number of cars is 518.281