The Dynamics Blog

How we fit tyre data to a Magic Formula model

A worked tyre-data example explains least-squares fitting, the link between cornering stiffness and lateral force, and how to check a Magic Formula model before using it.

Nine lateral-force samples at a vertical load of 5,000 newtons, with a recalculated Magic Formula curve. The curve rises to a broad peak and then falls as slip angle increases towards 12 degrees.
From discrete data to a continuous force curve. Black markers show the supplied values; the red line is the recalculated fit with consistent radian units. The fit describes these samples, but does not establish accuracy under other conditions.

A tyre model becomes useful when its parameters describe the tyre we want to simulate. Fitting connects the equation to data. It turns a set of measured points into a continuous relationship that a vehicle simulation can evaluate between those points.

Our first vehicle dynamics article explained how tyre models work and how the main approaches compare. Here, we use a numerical example to fit two linked Magic Formula relationships: cornering stiffness against vertical load, then lateral force against slip angle at a fixed load.

The process is to prepare the data, define the equation, adjust its parameters and examine the remaining errors. Each step matters. A smooth curve and a high fit score can still conceal an incorrect unit or an unsuitable model.

View the fitted force curve at full size ↗

Start with two clearly defined datasets

Cornering stiffness is the slope of lateral force against slip angle close to zero slip. It describes the tyre’s initial response to a steering input. It is not the force at the grip limit.

The first dataset gives cornering stiffness at vertical loads from 0 to 8,000 N. The second gives lateral force at slip angles from 0° to 12°, with vertical load fixed at 5,000 N. We also use 5,000 N as the reference load in the stiffness equation.

Two stages of one lateral tyre model.
StageInputQuantity to fitRows
1. Load sensitivityVertical load, Fz (N)Cornering stiffness, Kdeg (N/degree)9
2. Force curveSlip angle, α (degrees)Lateral force, Fy (N), at 5,000 N load9

The force values rise rapidly at small slip, remain near 4,060 N across several samples, then generally fall at larger angles. The model needs to capture this overall shape without following every variation between adjacent points.

See the input data for both fits

The two tables are separate datasets. Values below are rounded to three decimal places; calculations retain the supplied precision.

Cornering stiffness against vertical load.
Vertical load (N)Cornering stiffness (N/degree)
00.000
1,000487.352
2,0001,122.378
3,0001,461.080
4,0001,864.081
5,0002,036.080
6,0002,136.157
7,0002,348.081
8,0002,404.978
Lateral force at a fixed vertical load of 5,000 N.
Slip angle (degrees)Lateral force (N)
0.00.000
1.52,855.555
3.04,062.462
4.54,036.015
6.04,063.560
7.54,064.562
9.03,802.260
10.53,877.155
12.03,533.645

Before fitting, check units, force directions and test conditions. This example retains the supplied positive-angle, positive-force convention. A vehicle simulation may use different signs. Tyre identity, pressure, temperature, speed and measurement uncertainty are not specified here, so these data demonstrate a fitting method rather than define a complete racing tyre.

Give the solver a clear objective

The model predicts a value at every supplied input. The residual is the supplied value minus that prediction. Least-squares fitting adjusts the parameters to minimise the sum of the squared residuals:

Residual at point iri = yi − ŷi

Objective: sum of squared errorsSSE = Σ ri²

Here, y is the supplied value and ŷ is the model prediction. Squaring prevents positive and negative errors from cancelling, and gives larger errors more influence. The solver repeatedly changes the parameters, evaluates the curve and checks whether the objective has decreased.

We fit each dataset separately, with equal weight on its nine rows. We do not add stiffness errors in N/degree to force errors in N. A combined objective would need a stated scaling or weighting method. If measurement uncertainties were available, they could help define appropriate weights.

First, fit cornering stiffness against load

The load relationship uses two adjustable parameters, PKY1 and PKY2. To keep the equation readable, define a load ratio u:

Scaled loadu = Fz / (PKY2 Fz0)

Cornering stiffnessKdeg = Fz0 PKY1 sin[2 atan(u)]

Fz0 is the fixed reference load of 5,000 N. PKY1 sets the stiffness scale; PKY2 changes how that stiffness develops with load. The selected output unit is N/degree, so PKY1 carries a per-degree convention. Parameters must be converted if the output convention changes.

With positive parameter bounds, a starting pair of 0.5 and 1.7 converges to approximately PKY1 = 0.474698 and PKY2 = 1.719960. The curve follows the increasing stiffness while allowing the rate of increase to reduce at higher loads.

Original MATLAB plot of cornering stiffness against vertical load. Black data points rise from zero to about 2,405 newtons per degree at 8,000 newtons; a blue fitted curve follows their trend.View full size ↗
Fit the load trend. The original MATLAB plot shows the supplied stiffness values and the fitted equation. The calculation has been independently reproduced. The relevant sampled range is 0–8,000 N; the short plotted extension below zero load has no physical interpretation here.

Evaluating the fitted relationship at 5,000 N gives 2,062.678 N/degree. The supplied value at that load is 2,036.080 N/degree. The fitted value differs because both parameters were selected using all nine rows, rather than forcing the curve through the 5,000 N point.

We carry the fitted stiffness into the next stage. This keeps the force curve consistent with the load relationship already established.

Then fit lateral force against slip angle

The force calculation uses a simplified, unshifted Magic Formula. It represents pure lateral slip at the fixed load. There are no camber, combined-slip or transient terms in this example.

Convert both the angle and its stiffness convention. The trigonometric functions below use radians. Converting degrees to radians while leaving stiffness in N/degree would give the wrong initial slope.

Angle used in the calculationαrad = αdeg × π / 180

Stiffness used in the calculationKrad = Kdeg × 180 / π

Thus, 2,062.678 N/degree becomes 118,182.744 N/radian. These are two expressions of the same stiffness. We keep this value fixed while fitting three force-curve parameters.

Shape, force scale and curvatureC = PCY1,   D = FzPDY1,   E = PEY1

Set the initial slopeB = Krad / (CD)

Slip variable for this formulationz = B tan(αrad)

Curvature termq = z − E[z − atan(z)]

Lateral forceFy = D sin[C atan(q)]

C controls the overall shape, D sets the force scale, and E adjusts the curvature towards and beyond the peak. B is calculated from the other values. Near zero slip, the force slope is BCD = Krad, so the first-stage stiffness remains intact.

The brackets are part of the model: q can also be written as (1 − E)z + E atan(z). Changing that final plus sign changes the equation. The coefficients below belong to this exact formulation, including tan(α); they should not be transferred to another convention without checking it.

Least-squares fit at 5,000 N. Values are rounded for display.
ParameterValueRole
C = PCY11.416455Fitted shape factor
PDY10.833198Fitted force-to-load scale
E = PEY1−1.278657Fitted curvature factor
D4,165.990 NCalculated force scale
B20.027789Calculated from stiffness

The resulting curve appears at the top of this article. It rises quickly, reaches a broad peak and falls at larger slip angles. A model peak between sample positions is a prediction, not an additional measurement.

Set up the fit in MATLAB or Excel

Both tools can solve the same least-squares problem. The important common inputs are the equation, data, units, adjustable parameters, bounds and objective.

MATLAB Curve Fitter

Load the input and output columns, choose a custom equation, and enter the stiffness relationship. Keep Fz0 fixed and fit only PKY1 and PKY2. Set their lower bounds to a small positive value, such as 0.000001, to avoid a zero denominator. Use the starting pair above and select nonlinear least squares.

For the force fit, convert the angle column to radians and use the fitted Krad as a constant. Fit C, PDY1 and E; calculate B and D within the expression. When entering vector expressions in code, use element-wise multiplication, division and powers where required. MathWorks’ custom-model guidance explains the equation and fit-option setup.

Excel Solver

  1. Put each input and supplied output on the same row. Keep adjustable parameters in separate cells and use absolute references to them.
  2. Calculate the model prediction, then the squared residual, on each row. Sum the squared residuals in one objective cell.
  3. Open Solver, select that objective cell and choose Min. Select only the relevant parameter cells as the changing variables.
  4. Apply the same bounds and use GRG Nonlinear. For the force calculation, use RADIANS for slip angle and the converted stiffness. Permit E to be negative.
  5. Keep the result, plot the predictions and inspect the residuals. Repeat from different starting values.

Microsoft’s Solver guidance describes the objective, variable cells and constraints. Matching a fit in another program is a useful implementation check. It does not establish that the model predicts a real tyre under new conditions.

Starting values affect the search

For the force fit, use C = 1.5, PDY1 = 0.85 and E = 0 as one starting point. The force scale is near the observed ratio of lateral force to vertical load. In this example, the search bounds are 1 ≤ C ≤ 2, 0.1 ≤ PDY1 ≤ 2, and −5 ≤ E ≤ 1. These are numerical choices for this fit, not universal tyre limits.

A recalculation from 27 starting combinations reached the lower-error solution from 23 starts. Four stopped at C = 2 with a higher SSE. This shows why a solver’s successful termination is not enough: compare objectives, check whether a bound has been reached and inspect the resulting curves.

More function evaluations can help a search that stops early. They cannot repair an incorrect equation or guarantee the lowest possible error. A negative R² means the fitted predictions are worse, by that measure, than predicting the mean of the supplied outputs; it is a reason to investigate the setup.

Read the residuals as well as the curve

R² compares the squared residuals with the spread of the supplied outputs around their mean. A value close to one indicates a close fit to those values. It does not mean that the model is that percentage accurate in every operating condition.

The sample root mean square error used here is √(SSE/n), with n = 9. It expresses the typical residual scale in the output’s units.

Fit quality over all nine rows in each dataset, including the origin.
MetricCornering stiffnessLateral force
R²0.99610.9944
SSE22,593.22 (N/degree)²78,934.72 N²
Sample RMSE50.10 N/degree93.65 N
Largest absolute residual91.44 N/degree165.91 N

Both equations pass through the origin by construction. The zero row adds no information about their fitted parameters. For comparison, the original MATLAB stiffness output reports an RMSE of about 56.81 N/degree because it divides SSE by n − p, with p = 2 fitted parameters, before taking the square root. Check the definition before comparing software statistics.

Residuals for cornering stiffness and lateral force. Stiffness has its largest error at 6,000 newtons. Lateral force is underpredicted at 7.5 and 10.5 degrees and overpredicted most at 12 degrees.View full size ↗
Expose the errors hidden by the overall trend. Positive residuals mean the model predicts too little; negative residuals mean it predicts too much. The panels use different units and vertical scales. These are fitting errors, not uncertainty bounds.

At 12°, the model predicts 3,699.56 N, compared with a supplied value of 3,533.64 N. It overpredicts force by 165.91 N, about 4.7% of that supplied value. At 7.5°, it underpredicts by about 139.78 N. The high R² does not remove these local differences.

Repeated positive or negative residuals across a region can indicate that the equation misses part of the response. Scatter can also come from measurements. Without repeat tests and uncertainty estimates, we cannot assign each difference to a particular cause.

Know what the fitted model can support

This process produces a load-dependent stiffness relationship and a lateral force curve calibrated at 5,000 N. The force equation can return a number between the sampled angles, but that interpolation still needs checking. Extending it beyond 12°, or using its force parameters at other loads, goes beyond the demonstrated force data.

The unshifted equation also imposes symmetry between positive and negative slip. Only the positive side is supplied here, so that symmetry is an assumption. Holding the first-stage stiffness fixed means the second fit does not account for uncertainty in that stiffness.

Before using such a model for setup or lap simulation, test it against independent force curves at further loads and both slip directions. Add the evidence needed for camber, combined braking and cornering, temperature and transient response where those effects matter. Preserve the parameter units, sign convention and calibration range alongside the model.

Fitting provides an efficient description of the available data. Validation establishes whether that description is reliable enough for the vehicle decision we want to make.

Calculation notes

The stiffness plot is the original MATLAB figure. Numerical results and the new force and residual plots were independently recalculated using SciPy nonlinear least squares, with equal row weights and the equations and bounds stated above. The MATLAB and Excel sections describe how to set up the same problem; the new force-fit coefficients are not presented as outputs from those applications.

The 27 starts used every combination of C = {1.1, 1.5, 1.9}, PDY1 = {0.7, 0.85, 1.2} and E = {−2, 0, 0.5}. The lower SSE was 78,934.72 N²; the four runs that reached the C bound stopped at about 134,042.52 N². Comparing starts checks numerical sensitivity, but is not a proof of a global minimum.

The force calculation uses the standard Magic Formula curvature term, described in Uil’s tyre-model study, section 2.1, with tan(α) as the slip variable for this example. These coefficients describe the simplified formulation here, rather than a complete parameter file for a commercial tyre model.

Back to The Dynamics Blog