www.pudn.com > trackingdemos.zip > dis_cen_demo.m


% dis_cen_demo.m 
% 
% demo version for comparison of centralized vs. distributed trackers 
% using \alpha-\beta filter (steady state analysis of the WNA model) 
disp('----------------------------------------------------------------------'); 
disp('% Comparison of the steady state variance of centralized vs. distributed'); 
disp('% filter using WNA model'); 
disp('% ----------------------------------------------------------------------'); 
disp('»'); 
disp('»'); 
disp('% All local trackers use the same WNA model. The centralized and'); 
disp('% distributed trackers work in full communication rate without'); 
disp('% data association uncertainty. The track-to-track fusion is done'); 
disp('% optimally by exactly/approximately obtaining the cross-cov.'); 
disp('% between the local filters. However, the fusion result is still'); 
disp('% suboptimal comparing with the centralized filter'); 
disp('»'); 
disp('»'); 
disp('pause'); 
pause(5); 
 
N = 0; 
while N<1 | N>20 
   string_num_sensor = inputdlg('Number of Sensors Used for Comparison: ','Number of local trackers',1,{'2'}); 
   if isempty(string_num_sensor) 
      N = 2; 
   else 
      num_sensor = cell2struct(string_num_sensor, 'num'); 
      N = str2num(num_sensor.num); 
   end 
end 
 
% target maneuvering indices to be explored [.1, 10] 
low = log10(.1); 
high = log10(10); 
log_lambda = linspace(low, high, 30); 
lambda = 10.^log_lambda; 
T = 1;       % Sampling interval, but actually T does not have any effect on the results 
rho11 = .1;  % approx. coef. used in track-to-track fusion without analytical solution of 
rho22 = .67; % the cross-covariance matrix 
rho12 = sqrt(rho11*rho22); 
rho = [rho11, rho12; 
   rho12, rho22]; 
 
% centralized tracker 
lambda_c = lambda.*sqrt(N); 
beta_c = .25.*(lambda_c.^2+4.*lambda_c-lambda_c.*sqrt(lambda_c.^2+8.*lambda_c)); 
alpha_c = -.125.*(lambda_c.^2+8.*lambda_c-(lambda_c+4).*sqrt(lambda_c.^2+8.*lambda_c)); 
P11_cen1 = alpha_c./N; 
P12_cen1 = beta_c./T./N; 
P22_cen1 = beta_c./T./T.*(alpha_c-beta_c./2)./(1-alpha_c)./N; 
 
% distributed tracker 
beta_d = .25.*(lambda.^2+4.*lambda-lambda.*sqrt(lambda.^2+8.*lambda)); 
alpha_d = -.125.*(lambda.^2+8.*lambda-(lambda+4).*sqrt(lambda.^2+8.*lambda)); 
P1 = alpha_d; 
P12 = beta_d./T; 
P2 = beta_d./T./T.*(alpha_d-beta_d./2)./(1-alpha_d); 
I2 = []; 
for i=1:N 
    I2 = [I2;eye(2)]; 
end 
F = [1, T; 0, 1]; 
H = [1, 0]; 
for i=1:length(lambda) 
    Q = [T^4/4, T^3/2; T^3/2, T^2].*(lambda(i)^2/T^4); 
    W = [alpha_d(i); beta_d(i)/T]; 
    A = inv((eye(2)-W*H)*F); 
    B = -((eye(2)-W*H)*F)'; 
    C = -inv(F)*Q*(eye(2)-W*H)'; 
    % exact cross-covariance  
    D = lyap(A,B,C); 
    if i==1 
       D1 = D; 
    end 
    Pm = [P1(i), P12(i); P12(i), P2(i)]; 
    P = zeros(2*N, 2*N); 
    for j=1:N 
       for k=1:N 
          if j==k 
             P((j-1)*2+1:j*2,(k-1)*2+1:k*2) = Pm; 
          else 
             P((j-1)*2+1:j*2,(k-1)*2+1:k*2) = D; 
          end 
       end 
    end 
    P_dis = inv(I2'*inv(P)*I2); 
    P11_dis1(i) = P_dis(1,1); 
    P12_dis1(i) = P_dis(1,2); 
    P22_dis1(i) = P_dis(2,2); 
    % approxiamte cross-covariance 
    D_a = get_approx_cov1(Pm, Pm, rho); 
    if i==1 
       D1_a = D_a; 
    end 
    P_a = zeros(2*N, 2*N); 
    for j=1:N 
       for k=1:N 
          if j==k 
             P_a((j-1)*2+1:j*2,(k-1)*2+1:k*2) = Pm; 
          else 
             P_a((j-1)*2+1:j*2,(k-1)*2+1:k*2) = D_a; 
          end 
       end 
    end     
    % actual MSE 
    P_a_dis = inv(I2'*inv(P_a)*I2)*(I2'*inv(P_a)*P*inv(P_a)*I2)*inv(I2'*inv(P_a)*I2); 
    P11_a_dis1(i) = P_a_dis(1,1); 
    P12_a_dis1(i) = P_a_dis(1,2); 
    P22_a_dis1(i) = P_a_dis(2,2);     
    % filter calculated MSE 
    P_f_dis = inv(I2'*inv(P_a)*I2); 
    P11_f_dis1(i) = P_f_dis(1,1); 
    P12_f_dis1(i) = P_f_dis(1,2); 
    P22_f_dis1(i) = P_f_dis(2,2); 
end 
 
disp('»'); 
disp('»'); 
disp('F=');disp(F); 
disp('H=');disp(H); 
disp('Sampling interval = ');disp(T); 
disp('Target maneuvering index (TMI) = ');disp(lambda(1)); 
disp('Exact cross covariance between the local trackers: ');disp(D1); 
disp('Approximate cross covariance between the local trackers: ');disp(D1_a); 
disp('------------------------------------------------------------------------'); 
disp('Target maneuvering index (TMI) = ');disp(lambda(1)); 
disp('Pos. var. of centralized tracker: ');disp(P11_cen1(1)); 
disp('Pos. var. of distributed tracker: ');disp(P11_dis1(1)); 
disp('------------------------------------------------------------------------'); 
disp('The figure for comparing the pos. variance under various TMI'); 
disp('»'); 
disp('»'); 
disp('pause'); 
pause(5); 
 
% plot the results for comparison 
fig1 = figure('Name', 'Comparision of the steady state variance between the centralized and the distributed filters'); 
p1 = semilogx(lambda,P11_cen1./P1,'r-'); 
hold on; 
p2 = semilogx(lambda,P11_dis1./P1,'b--'); 
p3 = semilogx(lambda,P11_f_dis1./P1, 'k-.'); 
hold off; 
legend([p1, p2, p3], 'centralized', 'opt. distr.', 'approx. distr.', 0); 
xlabel('Target maneuvering index \lambda') 
ylabel('Ratios of p_{11} components of the steady state covariances to one-sensor case') 
title('Comparison of the ratios of filter covariances') 
disp('»'); 
disp('»'); 
disp('pause'); 
pause(5); 
close(fig1); 
 
disp('The difference in percentage of the pos. variance between centralized and distributed trackers'); 
disp('»'); 
disp('»'); 
disp('pause'); 
pause(5); 
Per1 = (P11_dis1-P11_cen1)./P11_cen1.*100; 
Per1_f = (P11_f_dis1-P11_cen1)./P11_cen1.*100; 
disp('The maximum difference in percentage: ');disp(max(Per1)); 
fig2 = figure('Name', 'Percentage of MSE difference between the centralized and the distributed filters'); 
p1 = semilogx(lambda, Per1, 'b-'); 
hold on; 
p4 = semilogx(lambda, Per1_f, 'b-.'); 
xlabel('Target maneuvering index \lambda') 
ylabel('Percentage difference of p_{11} of the steady state covariances') 
legend([p1, p4], 'exact', 'filter calculated', 2+(N>6)); 
title('Percentage of MSE difference between the centralized and the distributed \alpha-\beta filters') 
disp('»'); 
disp('»'); 
disp('pause'); 
pause(5); 
close(fig2); 
 
disp('------------------------------------------------------------------------'); 
disp('Target maneuvering index (TMI) = ');disp(lambda(1)); 
disp('Pos.-vel. cross-var. of centralized tracker: ');disp(P12_cen1(1)); 
disp('Pos.-vel. cross-var. of distributed tracker: ');disp(P12_dis1(1)); 
disp('------------------------------------------------------------------------'); 
disp('The figure for comparing the pos.-vel. cross-var. under various TMI'); 
disp('»'); 
disp('»'); 
disp('pause'); 
pause(5); 
 
fig3 = figure('Name', 'Comparision of the steady state covariance between the centralized and the distributed filters'); 
p1 = semilogx(lambda,P12_cen1./P12,'r-'); 
hold on; 
p2 = semilogx(lambda,P12_dis1./P12,'b--'); 
p3 = semilogx(lambda,P12_f_dis1./P12, 'k-.'); 
hold off; 
legend([p1, p2, p3], 'centralized', 'opt. distr.', 'approx. distr.', 0); 
xlabel('Target maneuvering index \lambda') 
ylabel('Ratios of p_{12} components of the steady state covariances to one-sensor case') 
title('Comparison of the ratios of filter covariances') 
disp('»'); 
disp('»'); 
disp('pause'); 
pause(5); 
close(fig3); 
 
disp('The difference in percentage of the pos.-vel. cross-var. between centralized and distributed trackers'); 
disp('»'); 
disp('»'); 
disp('pause'); 
pause(5); 
Per1 = (P12_dis1-P12_cen1)./P12_cen1.*100; 
Per1_f = (P12_f_dis1-P12_cen1)./P12_cen1.*100; 
disp('The maximum difference in percentage: ');disp(max(Per1)); 
fig4 = figure('Name', 'Percentage of MSE difference between the centralized and the distributed filters'); 
p1 = semilogx(lambda, Per1, 'b-'); 
hold on; 
p4 = semilogx(lambda, Per1_f, 'b-.'); 
xlabel('Target maneuvering index \lambda') 
ylabel('Percentage difference of p_{12} of the steady state covariances') 
legend([p1, p4], 'exact', 'filter calculated', 2); 
title('Percentage of MSE difference between the centralized and the distributed \alpha-\beta filters') 
disp('»'); 
disp('»'); 
disp('pause'); 
pause(5); 
close(fig4); 
 
disp('------------------------------------------------------------------------'); 
disp('Target maneuvering index (TMI) = ');disp(lambda(1)); 
disp('Vel. var. of centralized tracker: ');disp(P22_cen1(1)); 
disp('Vel. var. of distributed tracker: ');disp(P22_dis1(1)); 
disp('------------------------------------------------------------------------'); 
disp('The figure for comparing the vel. variance under various TMI'); 
disp('»'); 
disp('»'); 
disp('pause'); 
pause(5); 
 
fig5 = figure('Name', 'Comparision of the steady state covariance between the centralized and the distributed filters'); 
p1 = semilogx(lambda,P22_cen1./P2,'r-'); 
hold on; 
p2 = semilogx(lambda,P22_dis1./P2,'b--'); 
p3 = semilogx(lambda,P22_f_dis1./P2, 'k-.'); 
hold off; 
legend([p1, p2, p3], 'centralized', 'opt. distr.', 'approx. distr.', 3); 
xlabel('Target maneuvering index \lambda') 
ylabel('Ratios of p_{22} components of the steady state covariances to one-sensor case') 
title('Comparison of the ratios of filter covariances') 
disp('»'); 
disp('»'); 
disp('pause'); 
pause(5); 
close(fig5); 
 
disp('The difference in percentage of the vel. variance between centralized and distributed trackers'); 
disp('»'); 
disp('»'); 
disp('pause'); 
pause(5); 
Per1 = (P22_dis1-P22_cen1)./P22_cen1.*100; 
Per1_f = (P22_f_dis1-P22_cen1)./P22_cen1.*100; 
disp('The maximum difference in percentage: ');disp(max(Per1)); 
fig6 = figure('Name', 'Percentage of MSE difference between the centralized and the distributed filters'); 
p1 = semilogx(lambda, Per1, 'b-'); 
hold on; 
p4 = semilogx(lambda, Per1_f, 'b-.'); 
xlabel('Target maneuvering index \lambda') 
ylabel('Percentage difference of p_{22} of the steady state covariances') 
legend([p1, p4], 'exact', 'filter calculated', 2); 
title('Percentage of MSE difference between the centralized and the distributed \alpha-\beta filters') 
disp('»'); 
disp('»'); 
disp('pause'); 
pause(5); 
close(fig6); 
disp('»'); 
disp('End of Centralized vs. Distributed Filter Demo.'); 
disp('»');