Efficient localization method based on RSSI for AP clusters

Two problems in indoor RSSI-based localization are addressed: RSSI fluctuation and non-convexity of the maximum likelihood estimation localization problem. We propose two corresponding algorithms to solve them, namely the Relative Distance Weighting (RDW) algorithm and the Eigenvector-based Target Localization (ETL) algorithm.

The RDW algorithm is used to improve the ranging accuracy of RSSI samples.

%   RDW algorithm
%   Input: RSSmea(Targrt RSSI provided by ANs, 1*N);
%          RSSI_0(Reference RSSI at 1 m;
%          eta(Path Loss Exponent).
%   Output: RSSImea_rdw(Estimate of the target RSSI for the ANs)
function RSSImea_rdw=RDW(RSSImea,RSSI_0,eta)
N=size(RSSImea,2); % Number of AN
K=size(RSSImea,1); % Number of AP in an AN.
RSSImea_mean=zeros(1,N);
d_hmean=zeros(1,N);
gamma=zeros(1,N);
Wp=zeros(K,N);
RSSImea_rdw=zeros(1,N);
for n=1:N
    if size(RSSI_0,1)*size(RSSI_0,2)>1 % RSSI_0 and eta are different for ANs
        RSSI_n0=RSSI_0(n);
        etan=eta(n);
    else                               % RSSI_0 and eta are same for ANs
        RSSI_n0=RSSI_0;
        etan=eta;
    end
    for k=1:K
        RSSImea_mean(1,n)=RSSImea_mean(1,n)+RSSImea(k,n);
    end
    RSSImea_mean(1,n)=RSSImea_mean(1,n)/K;
    d_hmean(1,n)=(exp(1)).^((RSSI_n0-RSSImea_mean(1,n))./(10*etan));
    for k=1:K
        d_h(k,n)=(exp(1)).^((RSSI_n0-RSSImea(k,n))./(10*etan));
    end
    d_hMean(n)=d_hmean(1,n);
    for kk=1:K
        if d_h(kk,n)

ETL algorithm is used to improve localization accuracy and reduce computational effort.

%   ETL algorithm
%   Input: s(Coordinates of all ANs, 2*N vector with N is number of ANs); 
%          RSSmea(Targrt RSSI provided by ANs, 1*N);
%          RSSI_0(Reference RSSI at 1 m;
%          eta(Path Loss Exponent).
%   Output: u_final(Estimate of the target location)
function u_final=ETL(RSSImea,s,RSSI_0,eta)
% Initialization
s=s';
dim=length(s(1,:)); % Dimension of environment
N=length(s(:,1)); % Number of ANs
for n=1:N
    if size(RSSI_0,1)*size(RSSI_0,2)>1 % RSSI_0 and eta are different for ANs 
        RSSI_n0=RSSI_0(n);
        etan=eta(n);
    else                               % RSSI_0 and eta are same for ANs
        RSSI_n0=RSSI_0;
        etan=eta;
    end
    % Ranging results
    d_h(1,n)=(exp(1)).^((RSSI_n0-RSSImea(1,n))./(10*etan));
    dh_colum=d_h(:);
end

% Constructing the data matrix
w=1./(dh_colum.^4.*sum(1./dh_colum.^4));
sw=sum(w.*s)'; 
s2=s-ones(N,dim).*sw'; % Translate the original coordinate system
A=zeros(dim,dim);
b=zeros(dim,1);
for n=1:N
    sn=s2(n,1:dim)';
    wn=w(n);
    dn=dh_colum(n);
    A=A+wn*(2*(sn*sn')+(sn'*sn-dn^2)*eye(dim));
    b=b+wn*(dn^2-sn'*sn)*sn;
end
[U,D]=eig(A);
b=U'*b;
M=[-D -diag(b) zeros(dim,1);zeros(dim,dim) -D -b;ones(1,dim) zeros(1,dim) 0];

% Estimation of target location based on eigenvalues
[u,Lamda]=eig(M);
u=u./u(2*dim+1,:);
jj=0;
for j=1:2*dim+1
    if abs(u(2*dim+1,j))==1&&min(imag(u(dim+1:2*dim,j))==zeros(dim,1))
        jj=jj+1;
        u_candidat(:,jj)=u(dim+1:2*dim,j);
    end
end
N_candidat=length( u_candidat(1,:));
v_candidat=zeros(dim,N_candidat);
for i=1:N_candidat
    v_candidat(:,i)=inv(U')*u_candidat(:,i)+sw;
end
h=zeros(1,N_candidat);
for  jjj=1:N_candidat
    for n=1:N
        sn=s(n,1:dim)';
        wn=w(n);
        dn=dh_colum(n);
        h(jjj)= h(jjj)+wn*((v_candidat(:,jjj)-sn)'*(v_candidat(:,jjj)-sn)-dn^2)^2;
    end
end
[~, index]=min(h);
u_final=v_candidat(:,index);
end

你可能感兴趣的:(算法)