Plotting a Vehicle's Dynamic Performance Curves with MATLAB
When Automotive Theory gets to a vehicle’s dynamic performance, the textbook throws a pile of curves at you that look intimidating, but they all come out of a handful of basic formulas. As it happens, there was a big problem in class that gave all the parameters of a medium-duty truck and asked you to plot several characteristic curves. I decided to compute everything in MATLAB, walk through the whole pipeline from parameters to plots, and write it down.
The Problem
A medium-duty truck, with the following known data:
| Parameter | Value |
|---|---|
| Gross mass m | 9300 kg |
| Wheel rolling radius r | 0.49 m |
| Transmission efficiency (direct gear) | 0.9 |
| Transmission efficiency (other gears) | 0.85 |
| Rolling resistance coefficient f | 0.015 |
| Aerodynamic factor Cd·A | 4 m² |
| Final drive ratio i₀ | 6.33 |
Gear ratios and rotating-mass conversion coefficients for each gear:
| Gear | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|
| Ratio | 7.31 | 4.31 | 2.45 | 1.54 | 1 |
| Rotating-mass conversion coefficient | 3.17 | 1.77 | 1.27 | 1.12 | 1.07 |
Engine wide-open-throttle characteristic (torque Ttq at speed n):
| n (r/min) | 1200 | 1400 | 1600 | 1800 | 2000 | 2200 | 2400 | 2600 | 2800 |
|---|---|---|---|---|---|---|---|---|---|
| Ttq (N·m) | 326 | 334.5 | 343 | 340.5 | 338 | 332 | 326.5 | 313 | 300 |
Tasks:
- Compute and plot the driving-force / road-resistance balance diagram, and find the top speed and the maximum gradeability
- Compute and plot the acceleration-time curve in direct gear
- Compute and plot the dynamic-factor diagram
- Compute and plot the power-balance diagram
Step One: Load the Parameters into the Workspace
m=9300; r=0.49; efficiency_direct=0.9; efficiency_other=0.85;
f=0.015; cd_a=4; i_0=6.33; Ff=m*9.8*f;
gear_ratio(1)=7.31; gear_ratio(2)=4.31; gear_ratio(3)=2.45; gear_ratio(4)=1.54; gear_ratio(5)=1;
gear_i(1)=3.17; gear_i(2)=1.77; gear_i(3)=1.27; gear_i(4)=1.12; gear_i(5)=1.07;
engine_n(1)=1200; engine_n(2)=1400; engine_n(3)=1600; engine_n(4)=1800; engine_n(5)=2000;
engine_n(6)=2200; engine_n(7)=2400; engine_n(8)=2600; engine_n(9)=2800;
engine_T(1)=326; engine_T(2)=334.5; engine_T(3)=343; engine_T(4)=340.5; engine_T(5)=338;
engine_T(6)=332; engine_T(7)=326.5; engine_T(8)=313; engine_T(9)=300;
density_air=1.293;
Step Two: Densify the Engine Characteristic by Interpolation
The engine characteristic gives only 9 points—too sparse to integrate directly (which we’ll need later for the acceleration time). So first we use spline interpolation to densify it into a continuous curve. The interpolated speed is stored as nn and the torque as T_n:
nn=(1200:1:2800);
T_n=spline(engine_n,engine_T,nn);
Step Three: Compute Each Quantity One by One
Next we compute everything term by term following the formulas: driving force, vehicle speed, aerodynamic drag, acceleration, engine power, grade angle, acceleration time, and dynamic factor.
Driving force Ft, formula:
Ft_1_int=T_n*i_0*0.85*gear_ratio(1)/r;
Ft_2_int=T_n*i_0*0.85*gear_ratio(2)/r;
Ft_3_int=T_n*i_0*0.85*gear_ratio(3)/r;
Ft_4_int=T_n*i_0*0.85*gear_ratio(4)/r;
Ft_5_int=T_n*i_0*0.9 *gear_ratio(5)/r; % 5th gear is direct drive, so efficiency is 0.9
Vehicle speed ua, formula:
ua_1_int=nn*r*0.377/i_0/gear_ratio(1);
ua_2_int=nn*r*0.377/i_0/gear_ratio(2);
ua_3_int=nn*r*0.377/i_0/gear_ratio(3);
ua_4_int=nn*r*0.377/i_0/gear_ratio(4);
ua_5_int=nn*r*0.377/i_0/gear_ratio(5);
Aerodynamic drag Fw, formula:
Fw_1_int=cd_a*ua_1_int.^2/21.15;
Fw_2_int=cd_a*ua_2_int.^2/21.15;
Fw_3_int=cd_a*ua_3_int.^2/21.15;
Fw_4_int=cd_a*ua_4_int.^2/21.15;
Fw_5_int=cd_a*ua_5_int.^2/21.15;
Acceleration acc, formula:
acc_1=(Ft_1_int-Ff-Fw_1_int)/m/3.17;
acc_2=(Ft_2_int-Ff-Fw_2_int)/m/1.77;
acc_3=(Ft_3_int-Ff-Fw_3_int)/m/1.27;
acc_4=(Ft_4_int-Ff-Fw_4_int)/m/1.12;
acc_5=(Ft_5_int-Ff-Fw_5_int)/m/1.07;
Engine power Pe, formula:
for j=1:1601
Pe_1(j)=(m*9.8*0.015*ua_1_int(j)/3600+cd_a*ua_1_int(j)^3/76140+3.17*m*ua_1_int(j)/3600*acc_1(j))/efficiency_other;
Pe_2(j)=(m*9.8*0.015*ua_2_int(j)/3600+cd_a*ua_2_int(j)^3/76140+1.77*m*ua_2_int(j)/3600*acc_2(j))/efficiency_other;
Pe_3(j)=(m*9.8*0.015*ua_3_int(j)/3600+cd_a*ua_3_int(j)^3/76140+1.27*m*ua_3_int(j)/3600*acc_3(j))/efficiency_other;
Pe_4(j)=(m*9.8*0.015*ua_4_int(j)/3600+cd_a*ua_4_int(j)^3/76140+1.12*m*ua_4_int(j)/3600*acc_4(j))/efficiency_other;
Pe_5(j)=(m*9.8*0.015*ua_5_int(j)/3600+cd_a*ua_5_int(j)^3/76140+1.07*m*ua_5_int(j)/3600*acc_5(j))/efficiency_direct;
end
Grade angle and gradeability, formula:
angle(1,:)=asin((Ft_1_int-Ff-Fw_1_int)/m/9.8);
angle(2,:)=asin((Ft_2_int-Ff-Fw_2_int)/m/9.8);
angle(3,:)=asin((Ft_3_int-Ff-Fw_3_int)/m/9.8);
angle(4,:)=asin((Ft_4_int-Ff-Fw_4_int)/m/9.8);
angle(5,:)=asin((Ft_5_int-Ff-Fw_5_int)/m/9.8);
Acceleration time t, accumulated point by point using a differential method—essentially a first-order Runge-Kutta. Formula:
t(1)=0;
for i=2:1601
t(i)=(ua_5_int(i)-ua_5_int(i-1))/acc_5(i-1)+t(i-1);
end
Then we compute the total resistance for each gear, plus a continuous speed-resistance curve (used to draw the resistance line on the balance diagram):
F_1_resist=Fw_1_int+Ff;
F_2_resist=Fw_2_int+Ff;
F_3_resist=Fw_3_int+Ff;
F_4_resist=Fw_4_int+Ff;
F_5_resist=Fw_5_int+Ff;
ua_continue=[0:1:100];
F_resist_continue=Ff+1/2*density_air*ua_continue.^2*cd_a/3.6/3.6;
Dynamic factor D, formula:
D(1,:)=f+3.17/9.8*acc_1;
D(2,:)=f+1.77/9.8*acc_2;
D(3,:)=f+1.27/9.8*acc_3;
D(4,:)=f+1.12/9.8*acc_4;
D(5,:)=f+1.07/9.8*acc_5;
Step Four: Plot
Plot the quantities computed above as the four kinds of curves:
% Driving-force / road-resistance balance diagram
plot(ua_1_int,Ft_1_int,ua_2_int,Ft_2_int,ua_3_int,Ft_3_int,ua_4_int,Ft_4_int,ua_5_int,Ft_5_int,ua_continue,F_resist_continue);
xlabel('ua(km/h)');ylabel('F/N');title('Driving-force / road-resistance balance diagram')
% Maximum gradeability
plot(ua_1_int,tan(angle(1,:))*100,ua_2_int,tan(angle(2,:))*100,ua_3_int,tan(angle(3,:))*100,ua_4_int,tan(angle(4,:))*100,ua_5_int,tan(angle(5,:))*100);
xlabel('ua(km/h)');ylabel('i(%)');title('Gradeability diagram')
% Acceleration-time curve in direct gear
plot(t,ua_5_int);xlabel('t/s');ylabel('ua km/h');title('Acceleration-time curve in direct gear')
% Dynamic-factor diagram
f_continue=0.015*ones(1,101);
plot(ua_1_int,D(1,:),ua_2_int,D(2,:),ua_3_int,D(3,:),ua_4_int,D(4,:),ua_5_int,D(5,:),ua_continue,f_continue);
xlabel('ua(km/h)');ylabel('D');title('Dynamic-factor diagram')
% Power-balance diagram
plot(ua_1_int,Pe_1,ua_2_int,Pe_2,ua_3_int,Pe_3,ua_4_int,Pe_4,ua_5_int,Pe_5);
xlabel('ua km/h');ylabel('Pe/kW');title('Power-balance diagram')
Results
Reading off the plots:
- Top speed 81.71 km/h (the intersection of the driving-force curve and the resistance curve in top gear)
- Maximum gradeability 30% (the peak of the 1st-gear gradeability curve)
The five plots are below:
Driving-force / road-resistance balance diagram (the driving-force curves for each gear together with the upward-sweeping resistance curve; the intersection is the top speed):
Gradeability diagram (the 1st-gear peak is about 30%, which is the maximum gradeability):
Acceleration-time curve in direct gear:
Dynamic-factor diagram (the dynamic factor D; the horizontal line at the bottom is the rolling resistance coefficient f):
Power-balance diagram:
Working through this whole problem, my biggest takeaway is that a vehicle’s dynamic performance is really governed by just a few formulas: the engine wide-open-throttle characteristic + the gear ratios + the resistance model, and everything else is just combining them to integrate and find intersections. MATLAB here is just a handy calculator that saves you the trouble of interpolating and integrating by hand.