Matlab matched filtering help
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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
0 Commenti
Risposte (2)
Daniel Shub
il 28 Set 2011
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.
0 Commenti
Honglei Chen
il 28 Set 2011
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 Commenti
Honglei Chen
il 29 Set 2011
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.
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!