Project

Pacejka Magic formula-Curve fitting using matlab

Aim:

To perform curve fitting of Pacejka formula using Matlab

Given data:

The given tire test data can be accessed in the below link:

https://drive.google.com/file/d/1eilYx6ixnnWH7-yT0BWUqkb93hsg0Tr8/view?usp=sharing

Notations used:

`Y(X)` = Cornering force, braking force, aligning moment

`X` = Slip angle,skid ratio

B = Stiffness factor

C= Shape factor

D = Peak value

E = Curvature factor

`S_v,S_h` = offsets due to camber thrust, rolling resistance

Equations to be used:

`Y(X)=D*sin(C*arctan(Bx-E(Bx-arctan(Bx))`

`Y(X)=y(x)+S_v`

`x=X+S_h`

Matlab code:

%loading given test data file
data=load('tire_test_data');
alpha_data=data(:,1);
Mz_data=data(:,2);


%plotting
figure(1)
hold on
plot(alpha_data,Mz_data,'o')
xlabel('Slip angle')
ylabel('ALigning moment')
grid on

%pacejka formula
%coefficeints
Bz=0.2077;
Cz=2.165;
Dz=59.1;
Ez=-2.32;
Shz=0;
Svz=0;

for i=1:101
    alpha(i)=(i-1)*0.17;
    Alpha(i)=alpha(i)+Shz;
    mz(i)=Dz*sin(Cz*atan(Bz*Alpha(i)-Ez*(Bz*Alpha(i)-atan(Bz*Alpha(i)))));
    Mz(i)=mz(i)+Svz;
end

%plotting pacejka curve
plot(Alpha,Mz,'linewidth',2);
legend("Test data",'pacejka')


%RMS error
e=0;

for j=1:length(alpha_data)
    a(j)=alpha_data(j)+Shz;
    mz_e(j)=Dz*sin(Cz*atan(Bz*a(j)-Ez*(Bz*a(j)-atan(Bz*a(j)))));
    Mz_e(j)=mz_e(j)+Svz;
    e=e+(Mz_e(j)-Mz_data(j))^2;
end

%RMS
RMSE=(e/length(alpha_data))^0.5;
fprintf("Root mean square error is %.3f\n",RMSE)

Output:

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.