# Estimation of Traffic Flow Matlab Help

Estimation of Traffic Flow

Civil and transportation engineers must often estimate the future traffic flow on roads and bridges to plan for maintenance or possible future expansion. The following data gives the number of vehicles (in millions) crossing a bridge each year for 10 years. Fit a cubic
polynomial to the data and use the fit to estimate the flow in the year 2000

• Solution
If we attempt to fit a cubic to this data, as in the following session, we get a warning message. »Year = [1990:1999];
»VehFlow = [2.1,3.4,4.5,5.3,6.2,6.6,6.8,7,7.4,7.8];
»p = poly fit(Year,VehFlow,3)  Warning: Polynomial is badly conditioned.

The problem is caused by the large values of the independent variable Year. Because their range is small, we can simply subtract 1990 from each value. Continue the session
as follows. »x Year-1990; »p poly fit(x,Veh_Flow,3)
p = 0.0087 -0.1851 1.5991 »J = sum((poly val(p 3,x)-y).A2);
»S = sum((y-mean (y» .A2); »r2 = 1 – J/S r2
2.0362 0.9972

Thus the polynomial fit is good because the coefficient-of determination is 0.9972. The corresponding polynomial is
/ f = 0.0087«( – 1990)3 – 0.1851 (t – 1990)2 + 1.5991«( – 1990) + 2.0362 where f is the traffic flow in millions of vehicles, and ( is the time in years measured from O.We can use this equation to estimate the flow at the year 2000 by substituting t = 2000,
or by typing in MATLAB poly val (p , 10 ) . Rounded to one decimal place, the answer is 8.2 million vehicles. .

### Related Matlab Homework Assignments

Posted on July 30, 2015 in advanced Plotting and Model Building