using the extended kalman filter suppose there are two radarstations, a and b, each of them tracking the same object. station Aat co-ordinates π₯π =β4 ,π¦π =4 with the variance of measurementnoise at ππ2 =0.1,ππ½2 =0.01 and station B at co-ordinates π₯π=β8 ,π¦π =β3 with the variance of measurement noise at ππ2 =0.3,ππ½2=0.03. Fuse the two tracking results in real-time using theestimation passing method using matlab.
below are the codes for each station;
Station A
% Kalman filtering for moving target tracking
N = 100; % simulation timeT = 1; % samplingtimesiw = 0.01; siw2 = siw^2; % variance of velocity noisesir2 = 0.1; % variance of range measurementnoisesib2 = 0.01; % variance of bearing measurementnoisexbp = -4; % radar station xposition ybp = 4; % radar station yposition
A = [1 0 T 0; 0 1 0 T; 0 0 1 0; 0 0 0 1];Q = [0 0 0 0; 0 0 0 0; 0 0 siw2 0; 0 0 0 siw2 ];R = [sir2 0; 0 sib2];
xi = zeros(4,N); % ideal track = 0x = zeros(4,N); % real track = 0y = zeros(2,N); % measurement = 0xe = zeros(4,N); % estimated track = 0xo = zeros(2,N); % observed track = 0u = zeros(2,N); % direct changes to targets velocitypath.load flightpath.mat
Bu=[zeros(2,N);u];xi(1:4,1) = [-5; 10; 0.2; -0.2]; % initial ideal trackx(1:4,1) = [-5; 10; 0.2; -0.2]; % initial realtrackxo(1:2,1) = [-5; 10]; % initial observed trackxe(1:4,1) = [-6; 5; 0; 0]; % initialestimated trackP = [100 0 0 0; 0 100 00; 0 0 1000; 0 0 0 100]; % initial variance
y(1:2,1) =[sqrt((xo(1,1)-xbp)^2+(xo(2,1)-ybp)^2); atan2((xo(2,1)-ybp),(xo(1,1)-xbp))]; % initial measurement (not used)
w2 = siw*randn(2,N);v1 = sqrt(sir2)*randn(1,N); % rangemeasurement noisev2 = sqrt(sib2)*randn(1,N); % bearingmeasurement noisew1 = zeros(2,N);w = [w1; w2]; % noise in dynamic equation
I = eye(4);
for k=1:N-1 xi(1:4,k+1) = A*xi(1:4,k)+Bu(1:4,k); % ideal track x(1:4,k+1) = A*x(1:4,k)+Bu(1:4,k)+w(1:4,k); % real track
r = sqrt((x(1,k+1)-xbp)^2+(x(2,k+1)-ybp)^2); % range be = atan2((x(2,k+1)-ybp),(x(1,k+1)-xbp)); % bearing
y(1,k+1) = r+v1(k+1); % range measurement y(2,k+1) = be+v2(k+1); % bearing measurement
xo(1,k+1) = y(1,k+1)*cos(y(2,k+1))+xbp; % x measurement xo(2,k+1) = y(1,k+1)*sin(y(2,k+1))+ybp; % y measurement xpre = A*xe(1:4,k); % one-step prediction Pp = A*P*A'+Q; % prediction variance
rpre =sqrt((xpre(1)-xbp)^2+(xpre(2)-ybp)^2); bpre = atan2((xpre(2)-ybp),(xpre(1)-xbp)); C = [xpre(1)/rpre xpre(2)/rpre 0 0; -xpre(2)/rpre^2 xpre(1)/rpre^2 0 0]; K = Pp*C'*inv(R+C*Pp*C'); ypre = [rpre; bpre]; xe(1:4,k+1) = xpre + K*(y(:,k+1)-ypre); % estimationupdate P = (I-K*C)*Pp; % varianceupdateend
plot(x(1,:),x(2,:),'y.',xo(1,:),xo(2,:),'yo',xe(1,:),xe(2,:),'y-',xbp,ybp,'c*')
Station B
% Kalman filtering for moving target tracking
N = 100; % simulation timeT = 1; % samplingtimesiw = 0.01; siw2 = siw^2; % variance of velocity noisesir2 = 0.3; % variance of range measurementnoisesib2 = 0.03; % variance of bearing measurementnoisexbp = -8; % radar station xposition ybp = -3; % radar station yposition
A = [1 0 T 0; 0 1 0 T; 0 0 1 0; 0 0 0 1];Q = [0 0 0 0; 0 0 0 0; 0 0 siw2 0; 0 0 0 siw2 ];R = [sir2 0; 0 sib2];
xi = zeros(4,N); % ideal track = 0x = zeros(4,N); % real track = 0y = zeros(2,N); % measurement = 0xe = zeros(4,N); % estimated track = 0xo = zeros(2,N); % observed track = 0u = zeros(2,N); % direct changes to targets velocitypath.load flightpath.mat
Bu=[zeros(2,N);u];xi(1:4,1) = [-5; 10; 0.2; -0.2]; % initial ideal trackx(1:4,1) = [-5; 10; 0.2; -0.2]; % initial realtrackxo(1:2,1) = [-5; 10]; % initial observed trackxe(1:4,1) = [-6; 5; 0; 0]; % initialestimated trackP = [100 0 0 0; 0 100 00; 0 0 1000; 0 0 0 100]; % initial variance
y(1:2,1) =[sqrt((xo(1,1)-xbp)^2+(xo(2,1)-ybp)^2); atan2((xo(2,1)-ybp),(xo(1,1)-xbp))]; % initial measurement (not used)
w2 = siw*randn(2,N);v1 = sqrt(sir2)*randn(1,N); % rangemeasurement noisev2 = sqrt(sib2)*randn(1,N); % bearingmeasurement noisew1 = zeros(2,N);w = [w1; w2]; % noise in dynamic equation
I = eye(4);
for k=1:N-1 xi(1:4,k+1) = A*xi(1:4,k)+Bu(1:4,k); % ideal track x(1:4,k+1) = A*x(1:4,k)+Bu(1:4,k)+w(1:4,k); % real track
r = sqrt((x(1,k+1)-xbp)^2+(x(2,k+1)-ybp)^2); % range be = atan2((x(2,k+1)-ybp),(x(1,k+1)-xbp)); % bearing
y(1,k+1) = r+v1(k+1); % range measurement y(2,k+1) = be+v2(k+1); % bearing measurement
xo(1,k+1) = y(1,k+1)*cos(y(2,k+1))+xbp; % x measurement xo(2,k+1) = y(1,k+1)*sin(y(2,k+1))+ybp; % y measurement xpre = A*xe(1:4,k); % one-step prediction Pp = A*P*A'+Q; % prediction variance
rpre =sqrt((xpre(1)-xbp)^2+(xpre(2)-ybp)^2); bpre = atan2((xpre(2)-ybp),(xpre(1)-xbp)); C = [xpre(1)/rpre xpre(2)/rpre 0 0; -xpre(2)/rpre^2 xpre(1)/rpre^2 0 0]; K = Pp*C'*inv(R+C*Pp*C'); ypre = [rpre; bpre]; xe(1:4,k+1) = xpre + K*(y(:,k+1)-ypre); % estimationupdate P = (I-K*C)*Pp; % varianceupdateend
plot(x(1,:),x(2,:),'y.',xo(1,:),xo(2,:),'yo',xe(1,:),xe(2,:),'y-',xbp,ybp,'c*')
create a code to Fuse the two tracking results in real-timeusing the estimation passing method using matlab. Explain thestrategy of simulation and coding for completion of this task.
using the extended kalman filter suppose there are two radar stations, a and b, each of them tracking the same object. s
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am