a_toa_simul.m

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

M
38
字号
function [A, L]=A_TOA_simul(S,a,b)
%
% [A, L]=A_TOA_simul(S,a,b)
%
% This function compares the accuracy of the transmitter's localization
% computed analytically or by using the least square method. 
%
% S - the input matrix. The first row includes the coordinates of the
%     transmitter and the next rows include the coordinates the receivers.
%     The size of this matrix is (1 + number of receivers)*3. 
% a, b - mean square error and variance of the noise added to the distance
%        between the transmitter and the receivers. 
%
% A - the coordinates of the transmitter computed  analytically.
% L - the coordinates of the transmitter computed by using the least square
%     method.


% na vstupe bude matica rozmerov (n+1)*3, kde v jednotlivych riadkoch su
% suradnice najprv ciela a potom prijimacov
% vstupne parametre a,b vyjadruju strednu hodnotu, resp. rozptyl

[rows columns]=size(S);
V=zeros(rows-1,columns+1);
for i=2:rows
    r_i=sqrt((S(i,1)-S(1,1))^2+(S(i,2)-S(1,2))^2+(S(i,3)-S(1,3))^2)+ random('Normal',a,b);
    V(i-1,:)=[S(i,:),r_i];
end
%V;
C=[S(1,1),S(1,2),S(1,3)]
A=A_TOA_analytically(V)
L=A_TOA_LS(V)
    
plot3(S(:,1), S(:,2), S(:,3),'*k', S(1,1),S(1,2),S(1,3),'*r',A(1),A(2),A(3),'*b',L(1),L(2),L(3),'*c');

%% Date: 03.04.2007
%% Author: Maria Riskova

⌨️ 快捷键说明

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