- refactored variables

- added comments

git-svn-id: http://moon:8086/svn/software/trunk/projects/GnuRadio@455 b431acfa-c32f-4a4a-93f1-934dc6c82436
This commit is contained in:
2019-05-24 18:09:11 +00:00
parent 37b31be587
commit 80c6a697a6
+19 -18
View File
@@ -107,32 +107,33 @@ for k=1:numFrames
end end
end end
gate_peak = (X-Xm) >= Ad; % Create peak distances by subtracting Xm
peak_count = gate_peak.*peak_count + gate_peak; peak_dist = (X-Xm);
peaks = peak_count > 0; % Find peak candidates by thresholding
peaks = peak_dist >= Ad;
peak_pos = find(peaks); peak_pos = find(peaks);
% Output % Search true maximum peak using hill climbing
numPeaksLast = 0; numPeaksLast = 0;
while(1) while(1)
numPeaks = 0; numPeaks = 0;
for x = peak_pos, for pos = peak_pos,
while(1) while(1)
y0 = X(x); y0 = X(pos);
xp = min(Nh, x+1); pos_p = min(Nh, pos+1);
xn = max(1, x-1); pos_n = max(1, pos-1);
if X(xp) > y0 if X(pos_p) > y0
peaks(x) = 0; peaks(pos) = 0;
peaks(xn) = 0; peaks(pos_n) = 0;
x = xp; pos = pos_p;
elseif X(xn) > y0 elseif X(pos_n) > y0
peaks(x) = 0; peaks(pos) = 0;
peaks(xp) = 0; peaks(pos_p) = 0;
x = xn; pos = pos_n;
else else
peaks(xn) = 0; peaks(pos_n) = 0;
peaks(xp) = 0; peaks(pos_p) = 0;
numPeaks = numPeaks + 1; numPeaks = numPeaks + 1;
break; break;
end end