Matched filtering syntax problem
2 views (last 30 days)
Show older comments
Hello, i am trying to apply a Matchedfilter on a chirp signal on Matlab, and since im a beginner i couldnt solve the problem i had with this syntax. Can anyone help me plz?
t=0:0.001:2;
y= chirp(t,19,10,24);
x= step(y);
z= phased.MatchedFilter('filter',getMatchedFilter(y));
a= step(z,x);
plot(a);
0 Comments
Accepted Answer
Honglei Chen
on 24 Mar 2014
You are mixing several things here. y in your script is a signal vector, not a waveform, so it does not work with the step() method.
You can do either
t=0:0.001:2;
y= chirp(t,19,10,24);
a= filter(fliplr(y),1,y);
plot(a);
or
t=0:0.001:2;
y= chirp(t,19,10,24);
myFilter = phased.MatchedFilter('Coefficients',flipud(y(:)));
a= step(myFilter,y(:));
plot(real(a));
Note that MatchedFilter handles complex signal and assumes each column as a channel. It also handles the state in case you want to stream the filtering operation.
HTH
2 Comments
Honglei Chen
on 24 Mar 2014
These are just matched filter results. In this case, filter and xcorr does essentially the same thing. However, note that the horizontal axes are different. For xcorr, it outputs all lags, from -(N-1) to (N-1), where N is the length of the input signal. That's why you see the peak at the middle. On the other hand, filter only outputs N samples so you see the peak, at the end. The result of filter is basically the first half of the result using xcorr. You could argue that xcorr result is more intuitive but in real applications input and output are often the same length so filter makes more sense there. If you want to see the rest, just pass in another zero frame, you'll see the rest, e.g.,
a = filter(fliplr(y),1,y);
a1 = filter(fliplr(y),1,zeros(size(y)));
HTH
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!