- added peak boxes
- removed filtering code git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@443 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
+12
-9
@@ -41,6 +41,7 @@ am = 0.04;
|
||||
as = 0.9;
|
||||
Ad = 20;
|
||||
Cm = 0;
|
||||
pbh = 10;
|
||||
|
||||
s = zeros(1, Nh);
|
||||
a = zeros(1, Nh);
|
||||
@@ -78,6 +79,7 @@ for k=1:numFrames
|
||||
X = frames(k,:);
|
||||
X = X(1:Nh);
|
||||
end
|
||||
|
||||
% Peak detection
|
||||
Xs = (1-as)*Xs + as*X;
|
||||
gate_peak = Xs > (Ad+Xm);
|
||||
@@ -97,14 +99,6 @@ for k=1:numFrames
|
||||
end
|
||||
end
|
||||
|
||||
% Filtering
|
||||
if 0
|
||||
Nhf = 21;
|
||||
Ndf = (Nhf-1)/2;
|
||||
hf = [ones(1, Ndf), 0, -ones(1, Ndf)];
|
||||
Xf = abs(filter(hf, 1, X)/Nhf);
|
||||
end
|
||||
|
||||
% Output
|
||||
numPeaksLast = 0;
|
||||
while(1)
|
||||
@@ -139,8 +133,17 @@ for k=1:numFrames
|
||||
peak = peak_count > Cm;
|
||||
marker_Y = X.*peak;
|
||||
marker_X = find(peak > 0);
|
||||
|
||||
% Construct peak boxes
|
||||
peak_boxes = Xm;
|
||||
for x = find(peak > 0),
|
||||
pbox_start = max(1, x-pbh);
|
||||
pbox_end = min(Nh, x+pbh);
|
||||
peak_boxes(pbox_start:pbox_end) = X(x) * ones(1, pbox_end - pbox_start + 1);
|
||||
endfor
|
||||
|
||||
subplot(2, 1, 1)
|
||||
plot(1:Nh, X, marker_X, marker_Y(marker_X), '+'); grid; axis([0, Nh, -60, 40]);
|
||||
plot(1:Nh, X, marker_X, marker_Y(marker_X), 'ro', 1:Nh, peak_boxes, 'm-'); grid; axis([0, Nh, -60, 40]);
|
||||
subplot(2, 1, 2)
|
||||
plot(1:Nh, Xs, 1:Nh, Xm); grid; axis([0, Nh, -60, 40]);
|
||||
pause(1/30);
|
||||
|
||||
Reference in New Issue
Block a user