11/03/2006

黃世榮:經緯儀的定位

前言:早前出差去使用經緯儀,希望能用兩種角度去作定位
問題:如何在只有兩組經緯儀的角度下作空間點群的定位,在建立公式以及程式後,發覺程式當時剛學技巧有需要改進且似乎這樣的計算是有錯的,希望大家幫忙想
程式流程:
clear
format long
matrix=xlsread('diow.xls','sheet1','A2:L3'); %% read the data
[m,n]=size(matrix); %% get row and column
L=input('Input the L you get==> ')
%%request the distance between two measure point

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% to build the alpha's array
for i=1:m
A(i)=matrix(i,1)
%% to build the alpha's array
A2(i)=matrix(i,2)
%% to build the alpha's minute array
A3(i)=matrix(i,3)
%% to build the alpha's second array

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% to build the theta's array
S(i)=matrix(i,4)
%% to build the theta's array
S2(i)=matrix(i,5)
%% to build the theta's minute array
S3(i)=matrix(i,6)
%% to build the theta's second array

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% to build the Beta's array
B(i)=matrix(i,7)
%% to build the Beta's array
B2(i)=matrix(i,8)
%% to build the Beta's minute array
B3(i)=matrix(i,9)
%% to build the Beta's second array

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% to build the PHI's array

F(i)=matrix(i,10)
%% to build the PHI's array
F2(i)=matrix(i,11)
%% to build the PHI's minute array
F3(i)=matrix(i,12)
%% to build the PHI's second array
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% to make their unit coherence
for i=1:m
A(i)=A(i)+(A2(i)/60)+(A3(i)/3600)
S(i)=S(i)+(S2(i)/60)+(S3(i)/3600)
B(i)=B(i)+(B2(i)/60)+(B3(i)/3600)
F(i)=F(i)+(F2(i)/60)+(F3(i)/3600)
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%%%%find that limit it or not is no matter
for i=1:m
% if B(i)<90
C(i,1)=L*sin(B(i)/180*pi)/sin((B(i)-A(i))/180*pi)
% to build X's array (X,Y are not the real coordinate)
C(i,2)=L*sin(A(i)/180*pi)/sin((B(i)-A(i))/180*pi)
% to build Y's array
% end
% if B(i)>90
% C(i,1)=L*sin(B(i)/180*pi)/sin((B(i)+A(i))/180*pi)
% to build X's array
% C(i,2)=L*sin(A(i)/180*pi)/sin((B(i)+A(i))/180*pi)
% to build Y's array
% end
end


%% to build coordinates' matrix
for i=1:m
H(i,1)=C(i,1)*sin(A(i)/180*pi)
H(i,2)=C(i,1)*cos(A(i)/180*pi)
H(i,3)=C(i,1)*tan(S(i)/180*pi)
H(i,4)=C(i,2)*sin(B(i)/180*pi)
H(i,5)=C(i,2)*cos(B(i)/180*pi)+L
H(i,6)=C(i,2)*tan(F(i)/180*pi)
end


%output the data to excel
xlswrite('test',H,'sheet1','A2');

for i=1:m
plot3(H(i,1),H(i,2),H(i,3),'o');
plot3(H(i,4),H(i,5),H(i,6),'o');
hold on
end

沒有留言: