MATLAB PROJECT
MATLAB PROJECT
Objective;
To use linear algebra methods in MATLAB for solving systems of linear equations that
model traffic route for finding the quickest traffic route.
Problem Statement;
Find the quickest route to UET Taxila from Taxila bypass by analyzing traffic flow for
avoiding traffic congestion.
Data Collection
Intersections:
A: Residential area.
B: Commercial district.
C: School zone.
D: Highway entrance
A to B: 200
A to C: 150
B to C: 50
B to D: 250
Measuring Setup:
1. Traffic Counters: Manual counting stations were set up at each intersection to record
vehicle flows.
2. Time Period: Measurements were taken during peak hours (8:00 AM – 10:00 AM).
o Laptop
o MATLAB Software
General Procedure;
Steps to Solve Linear Equations in MATLAB:
1. Write the System in Matrix Form;
Represent the equations as Ax=b where A is the coefficient matrix, x is the variable vector and b
is the constant vector.
2. Define Matrices in MATLAB;
Create the coefficient matrix A and constant vector b in MATLAB.
Procedure:
1. Setup MATLAB in your pc or laptop. Open MATLAB by clicking on MATLAB Icon.
For Consideration:
2. Define variables for traffic flows on the roads, Let x1, x2, x3, x4 represent the flow rates
on the four routes.
x1+x2=200
x3+x4=150+x1
x3=50+x2
x4=250
4. Write matrix in command window:
1 1 0 0 200
−1 0 1 1 150
0 −1 1 0 50
0 0 0 1 250
B=rref(A)
1 0 0 0 175
0 1 0 0 25
0 0 1 0 75
0 0 0 1 250
6. Apply command;
C=B(:,5);
disp(C)
175
25
75
250
1. Define matrix A
A=[1 1 0 0 ;-1 0 1 1 ;0 -1 1 0 ;0 0 0 1 ]
1 1 0 0
−1 0 1 1
0 −1 1 0
0 0 0 1
2. Write matrix B as:
B=[200;150;50;250]
200
150
50
250
3. Apply command;
X=A\B
175
25
75
250
Results:
The solution from MATLAB yields the traffic flow rates on all routes:
x1=175
x2=25
x3=75
x4=250
MATLAB CODE:
“The Graph Shows That B to D route is quickest route among the all route”
Definition of "Quickest" in the Context;
In traffic analysis, a higher “traffic flow” (more vehicles per hour) often indicates that the route
is more frequently used and might have better conditions (wider roads, faster speeds, etc.).
For this project, "quickest" is interpreted as the route with the highest flow of vehicles.
2) Real-World Implications:
a) B to D has a traffic flow of 250 vehicles/hour, which is the “highest among all routes”. This
suggests it is a popular, well-utilized route, possibly due to factors like:
Conclusion:
By applying linear algebra and computational tools, this project demonstrates an effective
method to analyze and optimize traffic flow.