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


% MDL_demo.m 
% 
% demo version for comparison between the MDL model selection and the GLRT approach 
% in a one-dimensional detection problem using ML-PDA 
disp('----------------------------------------------------------------------'); 
disp('% Comparison of the model selection criteria between MDL and GLRT'); 
disp('% in the detection of unknown number of Gaussian signals under '); 
disp('% uniformly distributed false alarms'); 
disp('% ----------------------------------------------------------------------'); 
disp('»'); 
disp('»'); 
disp('% First, we show all the measurements in a set of scans. The Gaussian'); 
disp('% signals are overwhelmed by false alarms.'); 
disp('% Second, we draw the likelihood ratio for one signal vs. null hypothesis.'); 
disp('% Third, we compare the MDL vs. GLRT with a threshold for 95% power.'); 
disp('% Fourth, we perform Monte Carlo runs for model selection up to 2 signals.'); 
disp('% Finally, we present the estimation accuracy quantified by IRF.'); 
disp('»'); 
disp('»'); 
disp('pause'); 
pause(5); 
 
sigma = 1;          % std. of the Gaussian dis., known 
A = 10;             % upper limit of uniform dis., known 
string_lambda = inputdlg('Expected number of false alarms per unit volume: ','Expected Num. of FAs Per Unit Volume',1,{'0.08'}); 
if isempty(string_lambda) 
    lambda = 0.08; 
else 
    num_lambda = cell2struct(string_lambda, 'num'); 
    lambda = str2num(num_lambda.num); 
end 
Pd = 0.7;           % prob. of detection, both for target 1 and 2 
Pg = 0.999;         % prob. of the target originated meas. in gate 
disp('»'); 
disp('»'); 
disp('The surveillance volume is [-10, 10].'); 
disp('The location of possible signal is unknown and the false alarms are uniformly distributed.'); 
disp('The standard deviation of the measurement from an unknown Gaussian signal is 1.'); 
disp('The probability of signal detection is 0.7.'); 
disp('Let us assume only one signal presents...'); 
string_theta = inputdlg('Enter the location of a signal: ','Signal Location',1,{'3'}); 
if isempty(string_theta) 
    theta = 3; 
else 
    num_theta = cell2struct(string_theta, 'num'); 
    theta = str2num(num_theta.num); 
    if theta > 10 | theta < -10 
        theta = 3; 
    end 
end 
disp('»'); 
disp('»'); 
disp('We assume 40 scans are made before making a dection'); 
disp('Now, let us see how the measurements look like...'); 
N = 40; 
for i=1:N 
    Z_H0(i).Z = []; 
    Z_H1(i).Z = []; 
    M1 = poissrnd(2*A*lambda); 
    M2 = poissrnd(2*A*lambda); 
    if M1 > 0 
       Z_H0(i).Z = [Z_H0(i).Z, 2*A.*(rand(1,M1)-.5)]; 
    end 
    if M2 > 0 
       Z_H1(i).Z = [Z_H1(i).Z, 2*A.*(rand(1,M2)-.5)]; 
    end 
    if rand < Pd 
        Z_H1(i).Z = [Z_H1(i).Z, theta + sigma.*randn]; 
    end 
end 
fig1 = figure('Name', 'Plot of the measurements (one signal vs. none)'); 
subplot(2,1,1); 
hold on; 
for i=1:N 
    for j=1:length(Z_H0(i).Z) 
        plot(i, Z_H0(i).Z(j), 'b*'); 
    end 
end 
axis([1, N, -A, A]); 
title('No signal present'); 
hold off; 
subplot(2,1,2); 
hold on; 
for i=1:N 
    for j=1:length(Z_H1(i).Z) 
        plot(i, Z_H1(i).Z(j), 'b*'); 
    end 
end 
axis([1, N, -A, A]); 
title('One signal present'); 
hold off; 
disp('»'); 
disp('»'); 
disp('pause'); 
pause(5); 
close(fig1); 
 
disp('»'); 
disp('»'); 
disp('Now we show the negative log-likelihood ratio of one signal vs. none.'); 
disp('When one signal presents, its true location is ');disp(theta); 
 
theta0 = linspace(-A, A, 50); 
for i=1:length(theta0) 
   LLR_H0(i) = LLR_Gau_PDA2(theta0(i), Z_H0, sigma, lambda, Pd, Pg); 
   LLR_H1(i) = LLR_Gau_PDA2(theta0(i), Z_H1, sigma, lambda, Pd, Pg); 
end 
fig2 = figure('Name', 'Plot of the negative LLR of one signal vs. null hypothesis'); 
subplot(2,1,1); 
plot(theta0, LLR_H0); 
xlabel('location of the signal'); 
ylabel('negative LLR'); 
title('No signal present'); 
subplot(2,1,2); 
plot(theta0, LLR_H1); 
xlabel('location of the signal'); 
ylabel('negative LLR'); 
title('One signal present'); 
disp('»'); 
disp('»'); 
disp('pause'); 
pause(5); 
close(fig2); 
 
% Now, do the comparison of model selection between MDL and GLRT 
% by calling another mfile 
MDL_demo2;