solve and iterate solution with these the corrected

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: B = 934.9462 By=935.2182 + dYB = 935.1730 Cx= 1014.6641+dXC = 1014.65 Cy= 899.7266 + dYC = 899.6567 4 [ % Matlab script solution %least squares problem hmwk 10 clear; clc; % constant seconds/radian rho = 180*60*60/pi; %input measured values AB=91.84; AC=101.34; BC=87.15; AZAC=(90+81.68); AZAB=(90+135.14); AZBC=(AZAB-180+68.852); %input initial coordinates Ax=1000; Ay=1000; Bx=934.9008; By=935.2182; Cx=1014.6641; Cy=899.7266; while max(abs(X))>.001 && stop<2 %declare matrices A=zeros(6,4); L=zeros(6,1); %Calculate distances and azimuths based on coordinates AB0=((Ax-Bx)^2+(Ay-By)^2)^0.5; AC0=((Ax-Cx)^2+(Ay-Cy)^2)^0.5; BC0=((Bx-Cx)^2+(By-Cy)^2)^0.5; AZAB0=(180+atand((Bx-Ax)/(By-Ay))); AZAC0=(180+atand((Cx-Ax)/(Cy-Ay))); AZBC0=(180+atand((Cx-Bx)/(Cy-By))); %Fill in values 5 % Row 1 A(1,1)=(Bx-1000)/AB0; A(1,2)=(By-1000)/AB0; L(1,1)=AB-AB0; % Row 2 A(2,1)=(Bx-Cx)/BC0; A(2,2)=(By-Cy)/BC0; A(2,3)=(Cx-Bx)/BC0; A(2,4)=(Cy-By)/BC0; L(2,1)=BC-BC0; % Row 3 A(3,3)=(Cx-Ax)/AC0; A(3,4)=(Cy-Ay)/AC0; L(3,1)=AC-AC0; % Row 4 A(4,1)=rho*(By-1000)/AB0^2; A(4,2)=rho*(Bx-1000)/AB0^2; L(4,1)=AZAB-AZAB0; % Row 5 A(5,1)=rho*(By-Cy)/BC0^2; A(5,2)=rho*(Bx-Cx)/BC0^2; A(5,3)=rho*(Cy-By)/BC0^2; A(5,4)=rho*(Cx-Bx)/BC0^2; L(5,1)=AZBC-AZBC0; % Row 6 A(6,3)=rho*(Cy-Ay)/AC0^2; A(6,4)=rho*(Cx-Ax)/AC0^2; L(6,1)=AZAC-AZAC0; %solve X=A\L %update coordinates Bx=Bx+X(1); By=By+X(2); Cx=Cx+X(3); Cy=Cy+X(4); stop=stop+1; end 6 4) Ph...
View Full Document

Ask a homework question - tutors are online