How do I create a matched filter for signal detection?
229 views (last 30 days)
Show older comments
Hello, I am doing a project and I need to compare the accuracy of signal detection using cross correlation and a matched filter. I have pulse train with added noise, I have managed to use the xcorr function to correlate my signal with the oulse train and I get a good result! However I am struggling to create a Matched filter algorithm. My cross correlation code is below. Any help will be greatly appreciated. Thank you.
fs = 1.5e6;%sample rate of 1,500,000
twin=0: (1/150)/fs: 0.01e-3;
tpulse = ([1:150]-1)*(1/fs);
fc =130e3;%centre frequency of 130kHz
w = 2*pi*fc;%omega
y = real(exp([-1i*w*tpulse]));%sin wave
a = hann(150);%hanning window to give it click profile
y2 = y.*a';
Nclick=10 %number of clicks;
start=((1:Nclick)*100e-6)/(1/fs); % defines a vector of start positions
y3=zeros(1,length(twin));
for ii=1:length(start);
y3(start(ii):start(ii)+length(y2)-1)=y2;
end;
SNR=0.2; % signal to noise 20%
noise=rand(1,length(y3));
y4=y3+noise;
c = xcorr2(y4,y2);
Also does the SNR value I've assigned have any effect on my signal?
1 Comment
Yateesh
on 12 Apr 2011
when i am running the above code in my matlab..its saying "the specified module could not be found".. what can be the problem..??
Accepted Answer
Honglei Chen
on 7 Apr 2011
You can refer to the following thread:
http://www.mathworks.com/matlabcentral/answers/4502-matched-filter
1 Comment
Ted Shultz
on 19 Apr 2020
hyperlinked version of above answer: http://www.mathworks.com/matlabcentral/answers/4502-matched-filter
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!