A log-likelihood ratio detector (LLR) is a common tool in signal processing for detecting the presence of a known signal within a noisy observation. The basic idea is to compare the likelihood of the observation given that the signal is present versus the likelihood of the observation given that there is no signal. The logarithm of this ratio is then used as a decision statistic.
Here's some sample MATLAB code that implements an LLR detector for a simple binary signal:
main.m780 chars22 lines
This code generates a binary signal with alternating 1's and 0's and adds Gaussian noise with mean 0 and unit variance. It then calculates the likelihoods for the cases when the signal is present and when it is absent using the normpdf
function from the Statistics and Machine Learning Toolbox. The log-likelihood ratio is computed and plotted along with the original signal and the noisy observation.
Note that in practice, the LLR detector may require tuning of its parameters, such as the variance of the noise or the threshold for making a binary decision. Additionally, more sophisticated LLR detectors may be needed for more complex signals and noise models.
gistlibby LogSnag