Curve Fitting Test Data using Pacejka
AIM: To perform curve fitting using the Pacjecka magic formula.
GIVEN DATA:
Tire Test Data: https://drive.google.com/file/d/1_DnjoBslvM4N4z5fjBSevGC0fi0QUEhd/view?usp=sharing
OBJECTIVE:
- To obtain fit coefficients so that your curve describes the tire test data accurately
- To calculate the RMS error of the curve fit. Tune your coefficients so that the RMS error is less than 2.0 Nm
GOVERNING EQUATION: The Packejka Magic Formula can be given as:
|
`Y(X) = D.sin[C.tan^(_1){Bx - E(Bx - tan^(-1)(Bx))}]` `Y(X) = y(x) + S_v` `x = X + S_h` where; `Y(X)` = Cornering force, Braking force or Self-aligning moment `x` = Slip angle or Skid ratio `B` = Stiffness factor `C` = Shape factor (controls stretching in X-directon) `C` = 1.3 ... (Lateral force) `C` = 1.65 ... (Longitudinal force) `C` = 2.4 ... (Self-aligning moment) `D` = Peak value or Peak factor `E` = Curvature factor (affects transition between and position X_m at which peak value occurs) `E = frac(Bx_m - tan(frac(pi)(2C)))(Bx_m - tan^(-1)(Bx_m)` `S_v` , `S_h` = Vertical shift and Horizontal shift (offsets to account for camber thrust, conicity, ply steer or rolling resistance) |
![]() |
SOLUTION:
Programming Language: MATLAB
Code:
% Brush Tire Model - Magic formula
% Input data:
load tire_test_data;
alpha = tire_test_data(:,1);
M_z = tire_test_data(:,2);
% Plot:
plot(alpha,M_z,'o','linewidth',1)
xlabel('Slip angle (deg)')
ylabel('Self aligning torque (N.m)')
title('Magic formula - Lateral force vs Longitudinal force for different Slip angles')
grid on
hold on
% Pac coefficients
Bz = 0.2;
Cz = 2.18;
Dz = 59;
Ez = -2.5;
Shz = 0;
Svz = 0;
for i=1:101
alpha_1(i) = (i-1)*0.16524;
A1(i) = alpha_1(i) + Shz;
phi_z = (1-Ez)*A1(i) + Ez/Bz*atan(Bz*A1(i));
m_z1(i) = Dz*sin(Cz*atan(Bz*phi_z));
M_z1(i) = m_z1(i) + Svz;
end
% Plot:
plot(A1,M_z1,'linewidth',3)
hold on
xlabel('Longitudinal force (N)')
ylabel('Lateral force (N)')
title('Lateral force vs Longitudinal force for different Slip angles')
legend('Test Data','Pac Formula')
grid on
% RMS Error
error = 0;
for i=1:size(alpha,1)
phi_z = (1-Ez)*(alpha(i) + Shz) + Ez/Bz*atan(Bz*(alpha(i) + Shz));
M_z2(i) = Dz*sin(Cz*atan(Bz*phi_z)) + Svz;
error = error + (M_z2(i) - M_z(i))^2;
end
rms_error = (error/size(alpha,1))^0.5
Output:

Plot:
CONCLUSION: The brush tire model using Pacejka's magic formula was fitted successfully by optimizing the pac coefficients and the RMS error obtained was 1.8607 Nm, which was within the given limits (2.0 Nm).
