function [crlb_u] = MultiStaticDfDlyLocCRLB(uo,T,S,c,Qtau)
% [crlb_u] = MultiStaticDfDlyLocCRLB(uo,T,S,c,Qtau)
%
% This function computes the CRLB of the position of a moving target using 
% differential delay measruements only. 
%
% Input parameter list:
% uo   : (2 x 1), Target position.
% T    : (2 x NumTx), Transmitter positions.
% S    : (2 x NumRx), Receiver positions.
% c    : Signal propogation speed (m/s).
% Qtau : Covairance matrix of the differential delay measurements.
% 
% Output parameter list:
% crlb_u : The CRLB of target position.
%
% Reference:
% Liu Yang, Le Yang and K. C. Ho, "Moving target localization in multistatic
% sonar by differential delays and Doppler shifts," IEEE Signal Process. 
% Lett., vol. 23, no. 9, pp. 1160-1164, Sep. 2016.
% 
% Liu Yang, Le Yang and K. C. Ho   09-2016
% 

M = length(T(1,:));                       % Numbers of transmitters
N = length(S(1,:));                       % Numbers of receivers
unit = @(x,y) (x-y)/norm(x-y);            % the unit vector from y to x.

tau_u = zeros(M*N,2);
for i = 1:M
    for j = 1:N
        tau_u((i-1)*N+j,:) = (unit(uo,T(:,i))'+unit(uo,S(:,j))')/c;
    end
end

crlb_u = trace(inv(tau_u'*inv(Qtau)*tau_u));
