function sol = RangeRadar_sigfit( X, Y, S, t, B, tau, f_LC)
%RANGERADAR_SIGFIT Summary of this function goes here
%   Detailed explanation goes here

n = size(X,1)/3;  % X = [real(sigma), imag(sigma), xi]
% S = sorted subset in 1:n

sigma = X(1:n) + 1i*X(n+1:2*n);
xi = X(2*n+1:3*n);

tautil = tau + xi;

%S = find(sigma ~= 0);

%sol = Y - exp( -2i*pi*B*kron(t,transpose(tautil)) ) * (f_LC(-tautil) .* sigma);
%sol = abs( Y - exp( -2i*pi*B*kron(t,transpose(tautil)) ) * (f_LC(-tautil) .* sigma) );
sol = abs( Y - exp( -2i*pi*B*kron(t,transpose(tautil(S))) ) * (f_LC(-tautil(S)) .* sigma(S)) );



end

