Matlab实现双环平差计算#闭合差#波波夫差法

%Matlab双环平差
%画图
Ax=[0 3 5 3 10 3 10 4];
Ay=[-1 12 3 12 12 12 12 21];
Bx=[15 10 12 5 12 4 11 11];
By=[-1 12 3 3 3 21 21 21];%表示基准线  CF BA CB FA CD FE DE
X=[Ax ; Bx];
Y=[Ay ; By];
line(X,Y);

%初始值
AB = -16.81;
BC = 17.51;
CF = -15.20;
FA = 13.70;
Closing_error1 = AB+BC+CF+FA;
CD = -12.81;
DE = 13.61;
EF = -15.40;
FC = 15.20;
Closing_error2 = CD+DE+EF+FC;
loop_number = 0;

%平差循环
while abs(Closing_error1) > 0.000000001
  if abs(Closing_error1)>abs(Closing_error2)
      k1 = -(Closing_error1)/4;
      AB=AB+k1;
      BC=BC+k1;
      CF=CF+k1;
      FA=FA+k1;
      Closing_error1 = AB+BC+CF+FA;
      FC=-CF;
      Closing_error2 = CD+DE+EF+FC;
      k2=-(Closing_error2)/4
      CD=CD+k2;
      DE=DE+k2;
      EF=EF+k2;
      FC=FC+k2;
      Closing_error2 = CD+DE+EF+FC;
      CF=-FC;
      Closing_error1 = AB+BC+CF+FA;
      
  else
      k2=-(Closing_error2)/4
      CD=CD+k2;
      DE=DE+k2;
      EF=EF+k2;
      FC=FC+k2;
      Closing_error2 = CD+DE+EF+FC;
      CF=-FC;      
      Closing_error1 = AB+BC+CF+FA;
      k1 = -(Closing_error1)/4;
      AB=AB+k1;
      BC=BC+k1;
      CF=CF+k1;
      FA=FA+k1;
      Closing_error1 = AB+BC+CF+FA;
      FC=-CF;
      Closing_error2 = CD+DE+EF+FC;
  end
  loop_number=loop_number+1;
end

%平差前(黑色)
txtDE = '(+13.61)'
text(6,22,txtDE)
txtEF = '(-15.40)'
text(11,17,txtEF)
txtFA = '(+13.70)'
text(11,9,txtFA)
txtAB = '(-16.81)'
text(7,2,txtAB)
txtBC = '(+17.51)'
text(1.6,7,txtBC)
txtCD = '(-12.81)'
text(1.5,17,txtCD)
txtCF = '(-15.20)'
text(6,10.8,txtCF)
txtFC = '(+15.20)'
text(6,12.8,txtFC)

%平差后(红色)
ab = string(AB)
text(9,2,ab,'color','red','FontSize',13)
bc = string(BC)
text(1.6,5.5,bc,'color','red','FontSize',13)
cf = string(CF)
text(7.8,10.8,cf,'color','red','FontSize',13)
fa = string(FA)
text(11,10.8,fa,'color','red','FontSize',13)
cd = string(CD)
text(1,15.4,cd,'color','red','FontSize',13)
de = string(DE)
text(6,23.5,de,'color','red','FontSize',13)
ef = string(EF)
text(11,18.5,ef,'color','red','FontSize',13)
fc = string(FC)
text(6,14,fc,'color','red','FontSize',13)

%标注平差次数与点位
loopnumber = string(loop_number)
text(1,-2,loopnumber,'color','blue','FontSize',14)
text(2,-2,'次平差后,闭合差精度e-4','color','blue','FontSize',14)
text(12,2,'A','color','green','FontSize',12)
text(5,2,'B','color','green','FontSize',12)
text(2.5,12,'C','color','green','FontSize',12)
text(4,22,'D','color','green','FontSize',12)
text(11,22,'E','color','green','FontSize',12)
text(11,12,'F','color','green','FontSize',12)
text(7,7,'(环1逆时针)','color','black','FontSize',12)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值