File Exchange

image thumbnail

Vehicle Path Tracking Using Model Predictive Control (MPC)

version 1.0.1 (1.23 MB) by MathWorks Student Competitions Team
This submission contains a model to show the implementation of MPC on a vehicle moving in a US Highway scene.


Updated 14 Dec 2020

From GitHub

View Version History

View license on GitHub

This submission contains a model to show the implementation of MPC on a vehicle moving in a US Highway scene. Steps below describe the workflow:

1. Generating waypoints
2. Calculating curvature for MPC implementation
3. Generating MPC pedal map
4. Visualizing vehicle final path in 2D, Bird's-Eye Scope and a 3D simulation environment.

The users can refer this model to perform path tracking applications for a given waypoints. The results can be visualized in a 2D plot that compares the obtained and the reference trajectory.

Please go through the readme file for more details on how to use the model and how to tune the controller:

Cite As

MathWorks Student Competitions Team (2021). Vehicle Path Tracking Using Model Predictive Control (MPC) (, GitHub. Retrieved .

Comments and Ratings (8)

Hi Nguyen,
Thanks for reaching out.
In the current model, we are using the parametric vehicle model. The vehicle model gets updated based on the longitudinal vehicle velocity. In case you want to define the mode based on the state-space model, you can select the "Use Vehicle Model" option in the block. This will create additional ports for A, B, and C matrices. You can create a script to update these matrices based on the feedback from the vehicle and the MPC controller. For reference, please go through this video:



Hi ,
I wonder why don't have any feedback from MPC controller to Internal Vehicle model (inside Path following control system). Could you give me some explain ?
Thanks you so much !

Thanks for the feedback Jayasri. We have added a simple model where the vehicle tracks a figure-eight course (two circles). Please feel free to try it out and share your feedback.

jayasri chennu

The model works excellent and it will be more useful for us if you can provide the Circular Path to this model.

Thank you.

Hi Mahrokh,

Thanks for reaching out.

Could you please elaborate on your query? You can also reach out to us at with all the details.


not working


MATLAB Release Compatibility
Created with R2020b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!