1、x=9.48:-0.1:8.18;y=8,8.2,8.4,8.6,8.8,9,9.2,9.4,9.7,10,10.1,10.3,10.5,10.7;y0=-2.79,-2.91,-3.02,-3.14,-3.25,-3.36,-3.47,-3.57,-3.67,-3.78,-3.87,-3.97,-4.06,-4.15plot(x,y,*);a=polyfit(x,y,1);xi=8.10:0.001:9.5;yi=polyval(a,xi);plot(x,y,go,MarkerEdgeColor,k,MarkerFaceColor,r,MarkerSize,5)plot(x,y0,*);a1
2、=polyfit(x,y,1);xi0=8.10:0.001:9.5;yi0=polyval(a1,xi0);plot(x,y0,go,MarkerEdgeColor,k,MarkerFaceColor,r,MarkerSize,5)xlabel(X(mm),fontsize,10); ylabel(电压V(),fontsize,10); axis(8.1 9.5 -4.2 11) hold on plot(xi,yi,linewidth,1,markersize,1) plot(xi0,yi0,linewidth,1,markersize,1) legend(原始数据点,拟合直线1,拟合直线2) plot(x,y) plot(x,y0)