toaa_toa_ls.m

来自「Active approach - TOA LS」· M 代码 · 共 52 行

M
52
字号
function T=A_TOA_LS(S)
%
% T=A_TOA_LS(S)
% 
% Function gives back the coordinates of the transmitter computed
% by the using the least square method.
% 
% S - the input matrix, where the coordinates of the receiver and its 
%     distance from the transmitter are in every row. 
%     The size of the matrix S is (number of receivers)*4.
%
% T - the coordinates of the calculated transmitter

% na vstupe matica rozmerov n*4

[rows,columns]=size(S);
A=zeros(rows-1,3);
b=zeros(rows-1,1);
for i=1:(rows-1)
    A(i,:)=[S(i+1,1)-S(1,1),S(i+1,2)-S(1,2),S(i+1,3)-S(1,3)];
    b(i)=0.5*[S(1,4)^2-S(i+1,4)^2-S(1,1)^2-S(1,2)^2-S(1,3)^2+S(i+1,1)^2+S(i+1,2)^2+S(i+1,3)^2];
end
T=(pinv(A)*b)';
    
%% Date: 03.04.2007
%% Author: Maria Riskova
 %
% T=A_TOA_LS(S)
% 
% Function gives back the coordinates of the transmitter computed
% by the using the least square method.
% 
% S - the input matrix, where the coordinates of the receiver and its 
%     distance from the transmitter are in every row. 
%     The size of the matrix S is (number of receivers)*4.
%
% T - the coordinates of the calculated transmitter

% na vstupe matica rozmerov n*4
%
% T=A_TOA_LS(S)
% 
% Function gives back the coordinates of the transmitter computed
% by the using the least square method.
% 
% S - the input matrix, where the coordinates of the receiver and its 
%     distance from the transmitter are in every row. 
%     The size of the matrix S is (number of receivers)*4.
%
% T - the coordinates of the calculated transmitter

% na vstupe matica rozmerov n*4

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?