How do we add AWGN or multipath noise in location estimation?

5 views (last 30 days)
Hello, I have tried location estimation using a Kalman filter giving TDOA estimates as input to the kalman filter. Now I need to add noise (AWGN or multipath noise) to the inputs and see the performance of the kalman filter, i.e. how accurately the Kalman filter is able to give the estimates. Can anyone help me with this?
%% Abstract function [anchorLoc,mobileLoc,LocEst]=SingleLocalization(P,networkSize,N) % Localization is one the most important task of the future wireless sensor % networks (WSNs). There are lots of algorithm for localization and tracking of a % mobile node in the network which can categorized into following groups: % 1. distance based localization: which assumes that the distances between % the nodes of the WSN are measured. % 2. angle based localization: which assumes the mobile nodes can measure % the angles to the anchor nodes with respect to some origin. % 3. received signal strenght: In this type, it is assumed that the mobile % can only measure the signal power from the base stations at its % location % 4. Hybrid % % Here, we consider only the distance based localization of a single % target. There are N anchor nodes in the system and one mobile node, we % use the measured distances and we find the location of the mobile through % multilateration.
%% Setting Parameters crc = @(r,p,a) [r*cosd(a + p); r*sind(a + p)]; t = linspace(0, 360, 30); % Time centre = [30; 60]; % Circle Centre init_pos = atan2d(80-centre(2), 20-centre(1)); % Initial Position (°) radius = hypot(20-centre(1), 80-centre(2)); % Circle Radius locus = bsxfun(@plus, crc(radius, init_pos, t), centre); % Calculate Circle Locus figure(1) for k1 = 2:length(t) plot(locus(1,k1), locus(2,k1), 'gp', 'MarkerFaceColor','g') hold on plot(locus(1,1:k1), locus(2,1:k1), '-b') hold off axis([0 60 0 160]) grid axis equal drawnow end mobileLoc=locus'; M = length(locus(1,:));
% distance dependent err (standard deviation of the noise normalized to distance)
distMeasurementErrRatio = 0.1; % it means that the accuracy of distance measurement is 90 %
% for instance the inaccuracy of a 1m measured distance
% is around .1 meter.
% we consider a 100by100 area that the mobile can wander
anchorLoc=P;
% anchorLoc = [0 0; % set the anchor at 4 vertices of the region
% networkSize 0;
% 0 networkSize;
% networkSize networkSize];
% building a random location for the mobile node
% mobileLoc1 = networkSize*rand(M,2);
%mobileLoc = mobileLoc1';%awgn(mobileLoc1,10);
% Computing the Euclidian distances
% very fast computation :)
% distance = sqrt(sum( (anchorLoc - repmat(mobileLoc,N,1)).^2 , 2));
% easy to understand computation
distance = zeros(N,M);
for m = 1 : M
for n = 1 : N
distance(n,m) = sqrt( (anchorLoc(n,1)-mobileLoc(m,1)).^2 + ...
(anchorLoc(n,2)-mobileLoc(m,2)).^2 );
end
end
% Plot the scenario
f1 = figure(2);
clf
plot(anchorLoc(:,1),anchorLoc(:,2),'ko','MarkerSize',8,'lineWidth',2,'MarkerFaceColor','k');
grid on
hold on
plot(mobileLoc(:,1),mobileLoc(:,2),'b+','MarkerSize',8,'lineWidth',2);
% noisy measurements
distanceNoisy = distance + distance.*distMeasurementErrRatio.*(rand(N,M)-1/2);
% using gussian newton to solve the problem
% (http://en.wikipedia.org/wiki/Gauss%E2%80%93Newton_algorithm)
numOfIteration = 5;
% Initial guess (random locatio)
LocEst = networkSize*rand(M,2);
% repeatation
for m = 1 : M
for i = 1 : numOfIteration
% computing the esimated distances
distanceEst = sqrt(sum( (anchorLoc - repmat(LocEst(m,:),N,1)).^2 , 2));
% computing the derivatives
% d0 = sqrt( (x-x0)^2 + (y-y0)^2 )
% derivatives -> d(d0)/dx = (x-x0)/d0
% derivatives -> d(d0)/dy = (y-y0)/d0
distanceDrv = [(LocEst(m,1)-anchorLoc(:,1))./distanceEst ... % x-coordinate
(LocEst(m,2)-anchorLoc(:,2))./distanceEst]; % y-coordinate
% delta
delta = - (distanceDrv.'*distanceDrv)^-1*distanceDrv.' * (distanceEst - distanceNoisy(:,m));
% Updating the estimation
LocEst(m,:) = LocEst(m,:) + delta.';
end
end
plot(LocEst(:,1),LocEst(:,2),'ro','MarkerSize',8,'lineWidth',2);
legend('anchor locations','TDOA true location','TDOA estimated location',...
'Location','Best')

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!