Matlab matched filtering help

4 次查看(过去 30 天)
vsee
vsee 2011-9-28
Hello
Here is a code that I wrote to analyze the prp(pulse repetition pattern) of a signal I am getting from an oscilloscope.
[signal_1,path_1] = uigetfile('*.csv','Select the .csv file to analyze');
if isequal(signal_1,0)
disp('User selected Cancel');
end
sig = csvread(fullfile(path_1, signal_1),0,3);
amp_1 = sig(1:2000000,2);
ts_1 = sig(2,1) - sig(1,1);
time_1 = ([0:2000000 - 1]*ts_1)';
ax1 = plot(time_1,amp_1);grid;
axis([0 max(time_1) -0.1 1.8]);
ax_handle = gca;
ii = 1;
fig_handle = gcf;
xlimit_orig = get(ax_handle, 'Xlim');
win_xlimit = [0 0.001];
offset = 0.001;
starter = uicontrol('parent',fig_handle,'Style','ToggleButton','String','start pan','Value',0,'Position',[150, 5, 60, 20]);
handle = uicontrol('parent',fig_handle,'Style','ToggleButton','String','pause/run','Value',1,'Position',[100, 5, 60, 20]);
getvalue = uicontrol('parent',fig_handle,'Style','ToggleButton','String','get value','Value',1,'Position',[20, 5, 60, 20]);
%Iterativley change the xlimit for the axes to pan across the figure
while win_xlimit(1) <= xlimit_orig(2) && ii <= 9
pause(5);
if get(starter,'Value') == 1
if get(handle,'Value') == 1
set(ax_handle, 'Xlim', win_xlimit);
win_xlimit = win_xlimit + offset;
end
end
if get(getvalue,'Value') == 0
[x(ii),y(ii)] = ginput(1);
ii = ii + 1;
set(getvalue,'Value',1);
end
end
prp = (x(2:ii-1)-x(1:ii-2))*1e+06;
disp('approximate prp is');
disp(prp);
The signal is huge (as you see I am reading in 2 million samples of my raw data). I am panning the signal in x-axis to find the pulses of interest and then conditionally use the ginput command to get values when needed. The problem is that ginput requires manual interference. I am trying to see if I can avoid this by implementing a matched filter that will retain the pulses and remove the noise. Can anybody please help on how to start designing a matched filter for a signal like this?
Thanks

回答(2 个)

Daniel Shub
Daniel Shub 2011-9-28
Depending on how noisy your data is you might just be able to use a simple threshold ...
time_1(amp_1 > threshold)
where you set an appropriate threshold.
If your data is noisy, then you probably want to do a crosscorrelation:
[y, lags] = xcorr(amp_1, template);
lags(y > threshold)
where you pick the appropriate threshold and template.

Honglei Chen
Honglei Chen 2011-9-28
Hi vsee
Here is an earlier post regarding matched filter
Since you have a huge data set, it may be better for you to process them in a streaming way. If you have Phased Array System Toolbox, you can take a look at
>> doc phased.MatchedFilter
HTH
  5 个评论
vsee
vsee 2011-9-29
True, the signal is distinguishable from the noise. However, I am only plotting 10000 points of the full signal. The full signal has multiple pulses staggered all over. What I am trying to achieve is an algorithm that can retain the pulses and get rid of the noise completely so I can calculate the prp.
Thanks again
Honglei Chen
Honglei Chen 2011-9-29
In this particular case, because you are reverting signal, it is an FIR filter so a is always 1.
I don't think there is an algorithm exist to retain the signal while completely get rid of the noise. There will always be some tradeoff between losing some signal vs. removing noise. If your goal is to make the pulse look clean, what you can do is to pass the pulse through a lowpass filter to get rid of some noise. However, your pulses then will not look like perfect rectangles.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Matched Filter and Ambiguity Function 的更多信息

标签

尚未输入任何标签。

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by