top of page

Create Your First Project

Start adding your projects to your portfolio. Click on "Manage Projects" to get started

Traffic Simulation

Description

Class project for Gateway Computing: MATLAB

Date

April 2022

Location

Johns Hopkins University

Skills

MATLAB, object-oriented programing, visual outputs, Euler's method for coupled differential equations

Objective

Write a computer program using object-oriented programming techniques that will simulate the flow of traffic around a circular track. The car objects should accelerate or decelerate based on the proximity to other cars. A green colored car is accelerating, a yellow colored car is coasting, and a red colored car is braking.

Role

This was an independent coding project.

Results

A video showing the traffic simulation animation for various scenarios can be seen in the Supporting Materials Page. The car objects successfully interacted with each other and propagation of traffic patterns can be seen.

Reflection

I had some issues with fine-tuning the parameters of the car objects (braking distance, deceleration and acceleration rates) and coding the interactions and checks for time step. The simulation worked, but I would have changed the frame rate of the animation for a smoother video output and had all the cars start from the same position at slightly different maximum velocities, to better replicate the variance in speed of motorists in the real world.

bottom of page