function center = findCenter(S)
%
% function center = findCenter(S)
% 
% Find the center of the sensors by fitting their positions to a cirle (2-D)
% or a sphere (3-D), corresponding to (27) in the reference paper below.
%
% Reference: S. Li and K. C. Ho, “Accurate and effective localization of an 
% object in large equal radius scenario,” IEEE Trans. Wireless Commun., 
% vol. 15, no. 12, pp. 8273-8285, Dec. 2016.
%
% Sasa Li, K. C. Ho    12-10-2016
%
%       Copyright (C) 2016
%       Computational Intelligence Signal Processing Laboratory
%       University of Missouri
%       Columbia, MO 65211, USA.
%       hod@missouri.edu
%

[N, M] = size(S);
hc = sum(S.^2)';
Gc = [2*S',ones(M,1)];
c = inv(Gc'*Gc)*Gc'*hc;
center = c(1:N);