Automatic Parking System with MATLAB 

 January 14, 2022

By  Abhishek Tyagi

Parking is a real challenge in congested parking lots and for inexperienced drivers. Automatic Parking Systems are limited to premium cars across the world.

In the current situation, explore the empty parking space and get the best maneuver as the parking has become boring due to the congested parking lot. The parking skills of the expert driver are transferred to an intelligent system that can lighten the driving load and improve safety in next-generation passenger vehicles. Automatic Parking Systems comes to the aid of inexperienced drivers to avoid collisions when parking in reverse.

In automatic parking systems, radar, sonar, vision, and ultrasonic sensors are used in combination to avoid obstacles in the parking path. APAS systems are available in various models from Toyota (Advanced Guided Parking System), Lexus (Intuitive Parking Assistant), Volkswagen (Park Assist), among others. Parking assistance modules cost between $500 and a few thousand dollars. This indicates the expensive nature of the sensors and algorithms built into the system and thus makes it inaccessible to small segment car owners. This has led to a lot of research and development in the use of ultrasonic sensor technology.

Proposed Model

In this model, working is shown using three already parked cars and an ego vehicle that needs to be parked. The car will be parked at the nearest slot, either beside cars or in between them.

MATLAB Implementation

Get Access to
Codes & Report!

An automatic parking assistance system helps the driver decide parking slot fitment and vehicle parking once the slot is confirmed. Learn APAS with MATLAB; Developed in MATLAB R2021a

Below, I am sharing some portions of the code to make the explanation part easier. It's not a complete code, and you are advised to purchase and download the entire code.

Global Variables

We are defining global variables, which can be used by the helper function while running of code.

global wl;
global ww;
global D;
global L;
global WSeta;

Parked cars

In next lines we are fixing coordinates of parked cars on the figure.

%% Rectangle Coordinates for Parked car 1

Tuning Parameters

These lines are used to tune parameters to use further.

WSeta=(WSeta/180)*pi; % degree to radians

Simulation Setup

Next we prepare a figure of required dimensions as well as required parameters.

Initialize Start Scenario

In the following lines of code, we plot all the required figures, and one function is also used to plot the ego vehicle in its turning position.

patch([Parked_Car2x1 Parked_Car2x2 Parked_Car2x3 Parked_Car2x4],[Parked_Car2y1 Parked_Car2y2 Parked_Car2y3 Parked_Car2y4],[0 1 1]);
patch([Parked_Car1x1 Parked_Car1x2 Parked_Car1x3 Parked_Car1x4],[Parked_Car1y1 Parked_Car1y2 Parked_Car1y3 Parked_Car1y4],[1 1 0]);
patch([Parked_Car3x1 Parked_Car3x2 Parked_Car3x3 Parked_Car3x4],[Parked_Car3y1 Parked_Car3y2 Parked_Car3y3 Parked_Car3y4],[1 0 1]);
title("Automatic parking Assistance System");
text(Parked_Car1x2,Parked_Car1y2+5,"Car 1");
text(Parked_Car2x2,Parked_Car2y2+5,"Car 2");
text(Parked_Car3x2,Parked_Car3y2+5,"Car 3");
text(Parked_Car2x2,Parked_Car2y2+40,"Parking Lot",'Color','red','FontSize',16);

Start Scenario

Start Scenario

Car Parking Scenario Simulation

Now we implement the final steps of the model where the whole simulation takes place. Using two other functions car can turn and then move back to reach the respective slot. At last, it displays the parked position of the vehicle.


The average time of users parking their vehicles will be effectively reduced in this system. This intelligent parking system provides better performance, low cost, and efficient large-scale parking systems.

Get instant access to the code, model, or application of the video or article you found helpful! Simply purchase the specific title, if available, and receive the download link right away! #MATLABHelper #CodeMadeEasy

Ready to take your MATLAB skills to the next level? Look no further! At MATLAB Helper, we've got you covered. From free community support to expert help and training, we've got all the resources you need to become a pro in no time. If you have any questions or queries, don't hesitate to reach out to us. Simply post a comment below or send us an email at [email protected].

And don't forget to connect with us on LinkedIn, Facebook, and Subscribe to our YouTube Channel! We're always sharing helpful tips and updates, so you can stay up-to-date on everything related to MATLAB. Plus, if you spot any bugs or errors on our website, just let us know and we'll make sure to fix it ASAP.

Ready to get started? Book your expert help with Research Assistance plan today and get personalized assistance tailored to your needs. Or, if you're looking for more comprehensive training, join one of our training modules and get hands-on experience with the latest techniques and technologies. The choice is yours – start learning and growing with MATLAB Helper today!

Education is our future. MATLAB is our feature. Happy MATLABing!

About the author 

Abhishek Tyagi

Abhishek Tyagi is an aspiring Automotive engineer who enjoys connecting the dots: be it ideas from different disciplines, people from different teams, or applications from different industries. He has strong technical skills and an academic background in engineering, statistics, and machine learning.

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

MATLAB Helper ®

Follow: YouTube Channel, LinkedIn Company, Facebook Page, Instagram Page

Join Community of MATLAB Enthusiasts: Facebook Group, Telegram, LinkedIn Group

Use Website Chat or WhatsApp at +91-8104622179