具体代码如下:
使用matlab编程实现
clear
% 选取画图的区域
for i = 60:1:120
[P0(i-59,1),P0(i-59,2)]=GSBL2xym(0,i,90);
[P1(i-59,1),P1(i-59,2)]=GSBL2xym(30,i,90);
[P2(i-59,1),P2(i-59,2)]=GSBL2xym(-30,i,90);
[P3(i-59,1),P3(i-59,2)]=GSBL2xym(60,i,90);
[P4(i-59,1),P4(i-59,2)]=GSBL2xym(-60,i,90);
end
for i = -90:90
[P5(i+91,1),P5(i+91,2)]=GSBL2xym(i,60,90);
[P6(i+91,1),P6(i+91,2)]=GSBL2xym(i,75,90);
[P7(i+91,1),P7(i+91,2)]=GSBL2xym(i,90,90);
[P8(i+91,1),P8(i+91,2)]=GSBL2xym(i,105,90);
[P9(i+91,1),P9(i+91,2)]=GSBL2xym(i,120,90);
end
% 实现画图
plot(P1(:,2),P1(:,1));
hold on
plot(P0(:,2),P0(:,1));
plot(P2(:,2),P2(:,1))
plot(P3(:,2),P3(:,1))
plot(P4(:,2),P4(:,1))
plot(P5(:,2),P5(:,1))
plot(P6(:,2),P6(:,1))
plot(P7(:,2),P7(:,1))
plot(P8(:,2),P8(:,1))
plot(P9(:,2),P9(:,1))
function [x,y] =GSBL2xym(B,L,Li)
%高斯正算
%GSBL_xy是将大地坐标转换为高斯坐标的函数
%输入的参量是大地坐标B、L(角度:如60度35分24.6秒,输入形式为:60.35246)
%L0为中央子午线经度
%M为子午圈曲率半径,N为卯酉圈曲率半径
%X为子午线弧长
%x,y为输出参数高斯平面直角坐标自然值
a=6378245.00000;
b=6356863.0187730473;
%将B由角度形式转换为弧度
deg3=fix(B);
min3=fix((B-deg3)*100);
sec3=((B-deg3)*100-min3).*100;
B=d2r(deg3,min3,sec3);
deg3=fix(Li);
min3=fix((Li-deg3)*100);
sec3=((Li-deg3)*100-min3).*100;
L1i=d2r(deg3,min3,sec3);
%将L由角度形式转换为弧度
deg4=fix(L);
min4=fix((L-deg4)*100);
sec4=((L-deg4)*100-min4).*100;
Le=d2r(deg4,min4,sec4);
c=a^2./b;
e2=sqrt(a^2-b^2)./b;
V=sqrt(1+(e2.^2).*(cos(B)).^2);
N=c./V;
t=tan(B);
n=sqrt((e2^2).*(cos(B)).^2);
l=Le-L1i;
[X] = GET2_X(a,b,B);%调用求解子午线弧长函数
x1=X;
x2=(N.*sin(B).*cos(B).*l.^2)./2;
x3=(N.*sin(B).*(cos(B)).^3.*(5-t.^2+9*(n.^2)+4*(n.^4)).*l.^4)./24;
x4=(N.*sin(B).*(cos(B)).^5.*(61-58.*(t.^2)+t.^4).*l.^6)./720;
x=x1+x2+x3+x4;
y1=N.*cos(B).*l;
y2=(N.*(cos(B)).^3.*(1-t.^2+n.^2).*l.^3)./6;
y3=(N.*(cos(B)).^5.*(5-18*t.^2+t.^4+14*n.^2-58.*(n.^2).*(t.^2)).*l.^5)./120;
y=y1+y2+y3;
end
function r = d2r(d,f,m)
r= (d+f/60+m/3600)/180*pi;
end
function x = GET2_X(a,b,B)
rb = B;
% a=6378137;
% b=6356752.31414;
% c=a*a/b;
e12=1-b*b/(a*a);
%e22=a*a/(b*b)-1;
m0 = a*(1-e12);
m2 = 3/2*e12*m0;
m4 = 5/4*e12*m2;
m6 = 7/6*e12*m4;
m8 = 9/8*e12*m6;
a0 = m0 + 1/2*m2 + 3/m4 +5/16*m6+35/128*m8;
a2 = 1/2*m2 + 1/2*m4 +15/32*m6+7/16*m8;
a4 = 1/m4 + 3/16*m6+7/32*m8;
a6 = 1/32*m6 + 1/16*m8;
a8 = 1/128*m8;
x = a0*rb - a2/2*sin(2*rb) + a4/4*sin(4*rb) -a6/6*sin(6*rb)+a8*sin(8*rb);
%x = a0*rb - sin(rb) * cos(rb)*((a2-a4+a6)+(2*a4-16/3*a6)*sin(rb)*sin(rb)+16/3*a6*(sin(rb))^4);
end
画出的图形效果如下: