- simplified update of Xm

git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@451 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2019-05-24 15:57:19 +00:00
parent c6c53e228d
commit 8c5c6bf221
+17 -13
View File
@@ -88,8 +88,25 @@ for k=1:numFrames
Xs = Xs + mean(X);
endif
% ----------------------
% Peak detection
% ----------------------
% Update of Xs
Xs = (1-as)*Xs + as*X;
% Update Xm at no-peak bins
Xm = (1-am)*Xm + am*X;
% Conditional update of Xm
last = Xm(1);
for n=2:Nh,
if Xm(n) < (last+2)
last = (1-am)*last + am*Xm(n);
else
Xm(n) = last;
end
end
gate_peak = (X-Xm) >= Ad;
peak_count = gate_peak.*peak_count + gate_peak;
@@ -197,19 +214,6 @@ for k=1:numFrames
end
endfor
% Update Xm at no-peak bins
Xm = (1-am)*Xm + am*X;
% Fill peak gaps with guessed values
last = Xm(1);
for n=2:Nh,
if (Xm(n) < (last+2)) or (peak_boxes_rel(n) == 0);
last = (1-am)*last + am*Xm(n);
else
Xm(n) = last;
end
end
% Create peak boxes with correct absolute height
peak_box_values = Xm;
peak_box_values((peak_boxes_rel > 0)) = peak_boxes_abs(peak_boxes_rel > 0);