資源描述:
《海底地形測量圖的插值模型MATLAB代碼.doc》由會員上傳分享,免費在線閱讀,更多相關內容在教育資源-天天文庫。
1、%數(shù)據輸入x_Yd=[129.0140.0108.588.0185.5195.5105.5157.5107.577.081.0162.0162.0117.5];y_Yd=[7.5141.528.0147.022.5137.585.5-6.5-81.03.056.5-66.584.0-38.5];z_Ft=[48686889988949];%由已知14點計算出14*14點(其中有兩點重復)%計算QiQj的值Qi_QjQi_Qj=zeros(14,14);fori=1:14forj=1:14Qi_Qj(i,j)=sqrt((x_Yd(i)-x_
2、Yd(j)).^2+(y_Yd(i)-y_Yd(j)).^2);endend[G_x,G_y]=meshgrid(x_Yd,y_Yd);%計算所求196個G點的坐標%求出每個G點對應的深度Z_gform=1:14fork=1:14if((m==k)
3、((m==12)&&(k==13))
4、((m==13)&&(k==12)))%排除Qi,Qj為同一點和重復點的情況Z_g(m,k)=z_Ft(m);continue;else%計算GQij=min{GQi,GQj}G_Qi=zeros(1,14);G_Qj=zeros(1,14);fori=1:
5、14G_Qi(i)=sqrt((G_y(m,k)-y_Yd(i)).^2+(G_x(m,k)-x_Yd(i)).^2);endforj=1:14G_Qj(j)=sqrt((G_x(m,k)-x_Yd(j)).^2+(G_y(m,k)-y_Yd(j)).^2);endG_Qij=zeros(14,14);[G_Qi,G_Qj]=meshgrid(G_Qi,G_Qj);G_Qij=min(G_Qi,G_Qj);%計算G點到Qi,Qj兩點連線的距離G_Pijfori=1:14forj=1:14ifsqrt((y_Yd(i)-y_Yd(j)).^2
6、+(x_Yd(i)-x_Yd(j)).^2)G_Pij(i,j)=abs((G_x(m,k)-x_Yd(i)).*(y_Yd(i)-y_Yd(j))-(G_y(m,k)-y_Yd(i)).*(x_Yd(i)-x_Yd(j)))./sqrt((y_Yd(i)-y_Yd(j)).^2+(x_Yd(i)-x_Yd(j)).^2);endendend%計算PQij=min{PQi,PQj}P_Qi=sqrt(G_Qi.^2-G_Pij.^2);P_Qj=sqrt(G_Qj.^2-G_Pij.^2);P_Qij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