-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCov_GTRS_MPR.m
60 lines (54 loc) · 2.12 KB
/
Cov_GTRS_MPR.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
function [ covGTRS ] = Cov_GTRS_MPR( senPos, srcLoc, Q )
%function [ covGTRS ] = Cov_GTRS_MPR( senPos, srcLoc, Q )
% Evaluating the theoretical covariance matrix of the source location
% estimate in MPR for the GTRS method. It can work with 2-D or 3-D scanario.
%
% Input:
% senPos: NxM, positions of reciving sensors, each column is a sensor
% position and the first column is the reference sensor
% position;
% srcLoc: Mx1, source location
% Q: (M-1)x(M-1), the covariance matrix of range differences (TDOAs).
% Output:
% covGTRS: NxN, covariance of source location estimate in MPR
%
% Reference: Y. Sun, K. C. Ho, and Q. Wan, "Solution and analysis of TDOA
% localization of a near or distant source in closed-form," IEEE Trans.
% Signal Process., vol. 67, no. 2, pp. 320-335, Jan. 2019.
%
% Yimao Sun, K. C. Ho 02-28-2019
%
% Copyright (C) 2019
% Computational Intelligence Signal Processing Laboratory
% University of Missouri
% Columbia, MO 65211, USA.
%
[N,M] = size(senPos);
r = sqrt(sum((senPos-repmat(srcLoc,1,M)).^2,1))';
rd = r(2:end)-r(1);
l = sqrt(sum((senPos(:,2:end) - repmat(senPos(:,1),1,M-1)).^2, 1))';
s_bar = senPos(:,2:end)./repmat(l',N,1);
u0 = srcLoc/r(1);
b = 1 + l.^2/r(1)^2 - 2/r(1)*l.*(s_bar'*u0);
B1 = -diag(sqrt(b));
W = eye(M-1)/(B1*Q*B1);
G1 = [senPos(:,2:end)', 0.5*(rd.^2 - sum(senPos(:,2:end)'.^2, 2))];
phi = [u0;1/r(1)];
C = inv(G1'*W*G1);
S = diag([ones(N,1);0]);
Cov2 = C*(eye(N+1)-(S*phi*phi'*S*C)/(phi'*S*C*S*phi));
if N == 2 % 2-D
doa = atan2(srcLoc(2),srcLoc(1));
D1 = [-sin(doa),cos(doa),0;
0,0,1];
elseif N == 3 % 3-D
theta = atan2(srcLoc(2), srcLoc(1));
phi = atan2(srcLoc(3), norm(srcLoc(1:2),'fro'));
D1 = [-sin(theta)/cos(phi), cos(theta)/cos(phi), 0, 0;
-cos(theta)*sin(phi), -sin(theta)*sin(phi), cos(phi), 0;
0, 0, 0, 1];
else
error('Please check your input format of sensor positions');
end
covGTRS = D1*Cov2*D1';