About this blog

I have created this blog with the intention of blogging on my academic interests. But you can't really hold me to that. I might post on anything that interests me.

Most of the posts, I guess, would be on problems that I find interesting. A majority of them would be from from Linear Algebra, probability, basic geometry, Communications, Signal Processing and Machine Learning; Some stuff might be from my previous love, Classical Physics.

So where do I get these problems/ articles/posts from? Do I think of them? Are they my original ideas? The answer to all such questions is a plain and simple No. I shamelessly copy stuff from the outside world and post them here as if they were my own (who doesn't?). This doesn't mean that all of the stuff that is here is stolen. I do intend blogging a fair deal on my research, which, by definition, is original. I also intend blogging on open problems on areas that I am conversant with, and the ones that I understand fairly well. Definitely, most of the problems would have solutions that are my own or thought process that is my own. But again, you can't really hold me to that either. :-)

Before finishing this write-up, there's something you probably need to know. Avoid using offensive language while you are here. I will just delete them the instant I see them. I don't care if the rest of the sentence contains the answer to why the Universe was created in the first place. I will simply delete it.

Hope you like my blog.

Tuesday 3 April 2012

NON-COHERENT DETECTION OF UNMODULATED SINUSOID IN AWGN CHANNEL


PROBLEM SETUP:

Non-coherent detection is a problem that comes up all the time in Radar signal processing. Alternate hypothesis is a noise corrupted random signal where the randomness in the signal, in this problem, is due to random phase of an unmodulated sinusoid. In a practical setting, this would correspond to the case where you are trying to detect stationary targets. The problem can be made more complex by introducing randomness in frequency and amplitude corresponding to moving targets. The null hypothesis corresponds to noise alone, whose statistics are known apriori.


MATLAB CODE:

clc;
clear all;
close all;

scale=0.05;
var1=scale*50;
var2=scale*100;                             %DIFFERENT NOISE VARIANCE ==> DIFFERENT SNRs
var3=scale*200;

sigma1=sqrt(var1);
sigma2=sqrt(var2);
sigma3=sqrt(var3);

i=0:9;
incmp=transpose(cos(i*0.2*pi));   %OPTIMUM RX ARCHITECTURE REQUIREMENT (DERIVED FROM BAYE'S MIN RISK ANALYSIS)
quadcmp=transpose(sin(i*0.2*pi)); %OPTIMUM RX ARCHITECTURE REQUIREMENT (DERIVED FROM BAYE'S MIN RISK ANALYSIS)

i1max=10000;                                %NUMBER OF EXPERIMENTS
threshold=-500:10:500;                      %THRESHOLD RANGE (THEORETICAL RANGE FROM -INFINITY TO +INFINITY)

for j=1:length(threshold)
    numdetect1(j)=0;       
    numfa1(j)=0;
    numdetect2(j)=0;                        %NUMBER OF DETECTIONS FOR DIFFERENT SNRs
    numfa2(j)=0;                            %NUMBER OF FALSE ALARMS FOR DIFFERENT SNRs
    numdetect3(j)=0;
    numfa3(j)=0;
   
    notst(j)=0;                             %NUMBER OF TIMES ALTERNATE HYPOTHESIS IS TRUE
    notsnt(j)=0;                            %NUMBER OF TIMES NULL HYPOTHESIS IS TRUE
   
    for i1=1:i1max
       
        teta=2*pi*rand(1);                  %GENERATE RANDOM PHASE FOR EACH EXPERIMENT FROM A UNIFORM DISTRIBUTION
        s=transpose(sin(0.2*pi*i+teta));    %GENERATE RANDOM SIGNAL EACH EXPT. BASED ON GENERATED RANDOM PHASE
       
        n1=sigma1*randn(10,1);
        n2=sigma2*randn(10,1);
        n3=sigma3*randn(10,1);
       
        sgnlpresent=randi(2)-1;             %RANDOM GENERATION OF HYPOTHESES
       
        if sgnlpresent==1
            notst(j)=notst(j)+1;
            r1=s+n1;
            r2=s+n2;                        %PROBABILISTIC TRANSITION MECHANISM FOR ALTERNATE HYPOTHESIS
            r3=s+n3;
        else
            notsnt(j)=notsnt(j)+1;
            r1=n1;
            r2=n2;                          %PROBABILISTIC TRANSITION MECHANISM FOR NULL HYPOTHESIS
            r3=n3;
        end
       
        inproc1=transpose(r1)*incmp;
        quadproc1=transpose(r1)*quadcmp;
        inproc2=transpose(r2)*incmp;        %PART OF SUFFICIENT STATISTIC
        quadproc2=transpose(r2)*quadcmp;    %PART OF SUFFICIENT STATISTIC
        inproc3=transpose(r3)*incmp;
        quadproc3=transpose(r3)*quadcmp;
       
        inprocsqr1=power(inproc1,2);
        quadprocsqr1=power(quadproc1,2);
        inprocsqr2=power(inproc2,2);
        quadprocsqr2=power(quadproc2,2);
        inprocsqr3=power(inproc3,2);
        quadprocsqr3=power(quadproc3,2);
       
        suffstat1=inprocsqr1+quadprocsqr1;
        suffstat2=inprocsqr2+quadprocsqr2;  %COMPUTING SUFFICIENT STATISTIC FOR DIFFERENT VALUES OF SNR
        suffstat3=inprocsqr3+quadprocsqr3;
       
        %THRESHOLDING FOR DECESION DEVICE AND COMPUTING Pr(False alarm) AND Pr(Detection) FOR DIFFERENT SNRs
       
        if suffstat1>threshold(j)
            detect1=1;
        else
            detect1=0;
        end
        if detect1==1 && sgnlpresent==1
            numdetect1(j)=numdetect1(j)+1;
        end             
        if detect1==1 && sgnlpresent==0
            numfa1(j)=numfa1(j)+1;
        end
        if suffstat2>threshold(j)
            detect2=1;
        else
            detect2=0;
        end
       
        if detect2==1 && sgnlpresent==1
            numdetect2(j)=numdetect2(j)+1;
        end
        if detect2==1 && sgnlpresent==0
            numfa2(j)=numfa2(j)+1;
        end
        if suffstat3>threshold(j)
            detect3=1;
        else
            detect3=0;
        end
        if detect3==1 && sgnlpresent==1
            numdetect3(j)=numdetect3(j)+1;
        end
        if detect3==1 && sgnlpresent==0
            numfa3(j)=numfa3(j)+1;
        end
    end
    pd1(j)=numdetect1(j)/notst(j);
    pf1(j)=numfa1(j)/notsnt(j);
    pd2(j)=numdetect2(j)/notst(j);
    pf2(j)=numfa2(j)/notsnt(j);
    pd3(j)=numdetect3(j)/notst(j);
    pf3(j)=numfa3(j)/notsnt(j);
end

figure(1);
plot(pf1,pd1,pf2,pd2,pf3,pd3,'linewidth',1.5);
xlim([0 1]);
ylim([0 1]);
xlabel('PROBABILITY OF FALSE ALARM');
ylabel('PROBABILITY OF DETECTION');
legend('d^2=2','d^2=1','d^2=0.5');
title('RECEIVER OPERATING CHARACTERISTICS FOR DIFFERENT VALUES OF SNR');
grid;


ROC PLOT:



SOME PHILOSOPHY:

Bayesian Risk analysis cannot be applied directly to partition the observation space in this case since the probabilistic transition mechanism is not constant for all vectors in the alternate hypothesis. However, since the phase distribution is known, the unknown parameter can be averaged out and subsequently, we can come up with some sort of an average for the probabilistic transition mechanism. Consequently, we can derive an optimal detection rule based on that. However, the ROC curve for this would only lie below that of coherent detection (this is also intuitive since in the coherent case, you have more knowledge about the signal that you want to detect). 

RECEIVER OPERATING CHARACTERISTICS (ROC) FOR BINARY HYPOTHESIS TESTING


PROBLEM SETUP:

  1)  Binary hypothesis testing problem
  2)  Null hypothesis: S = zeros(10,1)
  3)  Alternate hypothesis: S = ones(10,1)
  4)  Probabilistic transition mechanism: Multidimensional Gaussian with mean vector S and covariance matrix equal to scaled identity
  5)  SNR d2 defined as STQ-1S where Q is the covariance matrix of the multidimensional Gaussian distribution



MATLAB CODE:

clc;
clear all;
close all;
s=ones(10,1);
nos=zeros(10,1);
sigma=[sqrt(20) sqrt(10) sqrt(5)];

imax=10000;                %NUMBER OF EXPERIMENTS
threshold=-50:2:50;        %THRESHOLD RANGE OF LOG-LIKELIHOOD RATIO(THEORETICAL RANGE FROM -INFINITY TO +INFINITY)

for j=1:length(threshold)  %LOOP TO VARY THRESHOLD
   
    numdetect1(j)=0;       %NUMBER OF DETECTIONS
    numfa1(j)=0;           %NUMBER OF FALSE ALARMS
    numdetect2(j)=0;
    numfa2(j)=0;
    numdetect3(j)=0;
    numfa3(j)=0;
    notst(j)=0;             %NUMBER OF TIMES ALTERNATE HYPOTHESIS IS TRUE
    notsnt(j)=0;            %NUMBER OF TIMES NULL HYPOTHESIS IS TRUE
   
    for i=1:imax            %EXPERIMENT NUMBER i
       
        n=randn(10,1);
        n1=sigma(1)*n;      %GENERATE NOISE FOR i-th EXPT WITH DIFFERNT POWERS CORRESPONDING TO DIFFERENT SNRs
        n2=sigma(2)*n;
        n3=sigma(3)*n;
       
        sgnlpresent=randi(2)-1;    %RANDOM GENERATION OF HYPOTHESES
       
        if sgnlpresent==1
            notst(j)=notst(j)+1;
            r1=s+n1;               %PROBABILISTIC TRANSITION MECHANISM FOR ALTERNATE HYPOTHESIS FOR DIFFERENT SNRs
            r2=s+n2;
            r3=s+n3;
        else
            notsnt(j)=notsnt(j)+1;
            r1=nos+n1;
            r2=nos+n2;             %PROBABILISTIC TRANSITITON MECHANISM FOR NULL HYPOTHESIS FOR DIFFERENT SNRs
            r3=nos+n3;
        end                        
       
        suffstat1=transpose(r1)*s;       %COMPUTE SUFFICIENT STATISTIC FROM RECEIVED OBSERVATIONS
        suffstat2=transpose(r2)*s;
        suffstat3=transpose(r3)*s;       %STATISTIC DERIVED USING BAYE'S MINIMUM RISK ANALYSIS

       
        if suffstat1>threshold(j)
            detect1=1;
        else                                 %THRESHOLDING FOR DECESION DEVICE
            detect1=0;
        end          
        if detect1==1 && sgnlpresent==1
            numdetect1(j)=numdetect1(j)+1; 
        end                                 
        if detect1==1 && sgnlpresent==0
            numfa1(j)=numfa1(j)+1;
        end          
        pd1(j)=numdetect1(j)/notst(j);
        pf1(j)=numfa1(j)/notsnt(j);
       
        if suffstat2>threshold(j)
            detect2=1;
        else
            detect2=0;
        end          
        if detect2==1 && sgnlpresent==1
            numdetect2(j)=numdetect2(j)+1;
        end                                 %COMPUTING Pr(False Alarm) and Pr(Detection) FOR DIFFERENT SNRs
        if detect2==1 && sgnlpresent==0
            numfa2(j)=numfa2(j)+1;
        end          
        pd2(j)=numdetect2(j)/notst(j);
        pf2(j)=numfa2(j)/notsnt(j);
       
        if suffstat3>threshold(j)
            detect3=1;
        else
            detect3=0;
        end          
        if detect3==1 && sgnlpresent==1
            numdetect3(j)=numdetect3(j)+1;
        end
        if detect3==1 && sgnlpresent==0
            numfa3(j)=numfa3(j)+1;
        end          
        pd3(j)=numdetect3(j)/notst(j);
        pf3(j)=numfa3(j)/notsnt(j);
    end
end

figure(1);
plot(pf1,pd1,pf2,pd2,pf3,pd3,'linewidth',1.5);
title('RECEIVER OPERATING CHARACTERISTICS FOR DIFFERENT VALUES OF SNR');
xlabel('PROBABILITY OF FALSE ALARM');
ylabel('PROBABILITY OF DETECTION');
legend('d2=0.5','d2=1','d2=2');
grid;

ROC PLOT:


SOME PHILOSOPHY:

   1)  The statistic is derived in a generic framework using Bayes’ criterion. The result can be applied with minor modifications to problems whose null hypothesis, alternate hypothesis and probabilistic transition mechanism follow the model described in the beginning. I have tried this code to detect image signals in the presence of noise and it works properly.