cdateleida=[0 5 10 15 19 22 28 33 39 45 50 55 60 65 70 75 79 83 88 91 97 104 118 124 128 135 146 151 157 160 168 180 188 192 197 200 206 212 226 230]
popleida=[121.565083 121.565053 121.565033 121.565000 121.564967 121.564900 121.564833 121.564789 121.564733 121.564690 121.5646 121.564560 121.564517 121.564460 121.5644 121.564357 121.564317 121.564235 121.564167 121.564121 121.564083 121.563806 121.563717 121.563650 121.563567 121.563367 121.563183 121.563001 121.562798 121.562698 121.562568 121.562368 121.562117 121.562017 121.561908 121.561808 121.561692 121.561592 121.561452 121.561152]
bleida=[31.280313 31.280317 31.280030 31.280033 31.27972 31.27975 31.279332 31.279333 31.278980 31.278983 31.278565 31.278567 31.278330 31.278333 31.2776 31.2779 31.277630 31.277633 31.277214 31.277217 31.276963 31.276967 31.27611 31.27615 31.2754 31.2759 31.275263 31.275267 31.274770 31.274773 31.274420 31.274423 31.273765 31.273768 31.2732 31.2735 31.27320 31.27323 31.272930 31.272933]
cdateAIS=[0 10 19 28 39 50 60 70 79 88 97 118 128 146 157 168 188 197 206 226]
popAIS=[121.565083 121.565033 121.564967 121.564833 121.564733 121.5646 121.564517 121.5644 121.564317 121.564167 121.564083 121.563717 121.563567 121.563183 121.562798 121.562568 121.562117 121.561908 121.561692 121.561452]
bAIS=[31.280317 31.280033 31.27975 31.279333 31.278983 31.278567 31.278333 31.2779 31.277633 31.277217 31.276967 31.27615 31.2759 31.275267 31.274773 31.274423 31.273768 31.2735 31.27323 31.272933]
%sdate=(cdate-mean(cdate))./std(cdate)
pAIS=polyfit(cdateAIS,popAIS,3)
%p1=polyfit(sdate,pop,3)
popp1AIS=polyval(pAIS,cdateAIS)
%pop1=polyval(p1,sdate)
pbAIS=polyfit(cdateAIS,bAIS,3)
popb1AIS=polyval(pbAIS,cdateAIS)
%sdate=(cdate-mean(cdate))./std(cdate)
pleida=polyfit(cdateleida,popleida,3)
%p1=polyfit(sdate,pop,3)
popp1leida=polyval(pleida,cdateleida)
%pop1=polyval(p1,sdate)
pbleida=polyfit(cdateleida,bleida,3)
popb1leida=polyval(pbleida,cdateleida)
subplot(2,1,1)
plot(cdateleida,popp1leida,'c-',cdateleida,popleida,'m*')
legend('拟合曲线','采样数据');
axis([0,230,121.561,121.566])
xlabel('仿真步数');
ylabel('经度');
title('雷达位置数据——经度')
subplot(2,1,2)
plot(cdateleida,popb1leida,'c-',cdateleida,bleida,'m*')
legend('拟合曲线','采样数据');
axis([0,230,31.27,31.285])
xlabel('仿真步数');
ylabel('纬度');
title('雷达位置数据——纬度')
figure,
subplot(2,1,1)
res1leida=popleida-popp1leida
res2leida=bleida-popb1leida
plot(cdateleida,res1leida,'c*-')
hold on
plot(cdateleida,res2leida,'g+-')
legend('经度','纬度');
xlabel('仿真步数');
ylabel('残差');
title('雷达位置数据拟合残差')
subplot(2,1,2)
res1AIS=popAIS-popp1AIS
res2AIS=bAIS-popb1AIS
plot(cdateAIS,res1AIS,'b*-')
hold on
plot(cdateAIS,res2AIS,'k+-')
legend('经度','纬度');
xlabel('仿真步数');
ylabel('残差');
title('AIS位置数据拟合残差')