Magic Formula Tyre Library

version 1.1.3 (6.85 MB) by Tom Teasdale
MATLAB library for Magic Formula Tyre Modeling


Updated 30 Jul 2022

From GitHub

View License on GitHub

Magic Formula Tyre Library

View on File Exchange GitHub release (latest by date) GitHub downloads

[Fx,Fy] = magicformula.v62.eval(p,slipangl,longslip,inclangl,inflpres,FZW,tyreSide)
  • Computationally efficient Magic Formula tyre model functions
  • Code generation compatible
  • Automatically fit Magic Formula tyre models to data
  • TIR import/export (Tyre Property File format)
  • TYDEX import (Tyre Data Exchange format)

Fitting Example


  • MATLAB Base (tested with R2021a)
  • Optimization Toolbox (for fitting)
  • Signal Processing Toolbox (for raw measurement import)


There are several ways:

Usage and Examples

To get started with interactive examples, open the MATLAB live script doc/GettingStarted.mlx in your editor.

You can find further examples in the doc/examples folder.

I also created an open-source GUI application in MATLAB for interactive fitting of Magic Formula tyre models to measurement data. It uses this library as a submodule, meaning that fitted parameter sets with the GUI can be used with the equations provided by this CLI library. You can find it here: Link to GUI!


The project was motivated by my work in the Formula Student Team UPBracing. As I required a performant, easy-to-use and precise implementation of the Magic Formula, and existing implementations were not satisfactory (either being commercialized and therefore without source or very slow), it made sense to make my own version.

This library is currently used in the team's Torque-Vectoring algorithms and all vehicle-modeling applications. Therefore the model evaluation functions are suitable for code-generation and have actually proven to be only moderately slower than linear tire models.

I hope this project benefits some students passionate about Vehicle Dynamics. If you have any questions, don't hesitate to contact me! I will try and keep this project updated in the future. If you want to contribute, please do. But I must warn you, I am still new to publishing code as open-source and do not yet know the ins and outs of working collaboratively on GitHub.

This project would not have been possible without the data provided by the Formula SAE Tire Test Consortium (FSAE TTC) and the Calspan Tire Testing Research Facility (TIRF). De-identified and obscured test data has been used in examples and images or recordings of the application, to conform to the license agreement. Special thanks to Dr. Edward M. Kasprzak for granting me permission to provide the used, de-identified and obscured data for demonstration purposes.

Known Issues, Notes and Bugs

  • Currently only Magic Formula version 6.1.2 (62) is implemented
  • Of v6.1.2 the turn slip parameters have been reduced to constant parameters (noted by greek letter zeta in Pacejka's book). To remove the influence of these parameters, simply set them to unity (=1). The default parameter set automatically applies unity. This effectively ignores turn slip.
  • Equations (4.E7) and (4.E8) are ignored (velocity-dependent scaling of friction coefficient) to remove dependency on speed as input. Might be added as an alternative implementation in the future.
  • In some sub-equations a few scaling factors were not implemented
  • Self-aligning torque is not calculated/implemented (MZW).

Cite As

Tom Teasdale (2022). Magic Formula Tyre Library (, GitHub. Retrieved .

MATLAB Release Compatibility
Created with R2021a
Compatible with R2021a and later releases
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!
To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.