0.091077-0.05138-0.047449-0.00075215];B40=[0.177680.0430720.00681640.00185550.000689060.000350320.00028230-0.000038568];B0=spline(n0,B00,n);%插值拟合系数曲线。B1=spline(n0,B10,n);B2=spline(n0,B20,n);B3=spline(n0,B30,n);B4=spline(n0,B40,n);ua4=0.377*r*n/ig(4)/i0;%4、5档车速。ua5=0.377*r*n/ig(5)/i0;Ff=G*f;%滚动阻力。Fz4=Ff+CdA*(ua4.^2)/21.15;%4、5档空气阻力。Fz5=Ff+CdA*(ua5.^2)/21.15;Pe4=Fz4.*ua4./(y*3.6*1000);%4、5档克服行驶阻力所需功率。Pe5=Fz5.*ua5./(y*3.6*1000);fori=1:1:3401%计算燃油消耗率。b4(i)=B0(i)+B1(i)*Pe4(i)+B2(i)*Pe4(i).^2+B3(i)*Pe4(i).^3+B4(i)*Pe4(i).^4;b5(i)=B0(i)+B1(i)*Pe5(i)+B2(i)*Pe5(i).^2+B3(i)*Pe5(i).^3+B4(i)*Pe5(i).^4;endpg=7.0;Q4=Pe4.*b4./(1.02.*ua4.*pg);%计算百公里油耗。Q5=Pe5.*b5./(1.02.*ua5.*pg);plot(ua4,Q4,ua5,Q5);%绘制曲线。axis([01001030]);title('最高档与次高档等速百公里油耗曲线');xlabel('ua(km/h)');ylabel('百公里油耗(L/100km)');legend('4','5')