From 9daf1ecaab2e51a1a34520c48bb8234700085fc9 Mon Sep 17 00:00:00 2001 From: David Protzman Date: Thu, 28 Apr 2022 22:46:08 -0400 Subject: [PATCH] Added missing update to `prev_val` --- matlab/updated_scripts/normalized_xcorr_fast.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/matlab/updated_scripts/normalized_xcorr_fast.m b/matlab/updated_scripts/normalized_xcorr_fast.m index 72d6c28..97528e4 100644 --- a/matlab/updated_scripts/normalized_xcorr_fast.m +++ b/matlab/updated_scripts/normalized_xcorr_fast.m @@ -62,6 +62,9 @@ function [scores] = normalized_xcorr_fast(input_samples, filter, varargin) % Since the window is shifting to the right, subtract off the left-most value that was just removed and add % on the new value on the right running_sum = running_sum - prev_val + window(end); + + % The value that will be removed on the next iteration is the left-most value of the current window + prev_val = window(1); % Make the window zero mean by subtracting the average power window = window - (running_sum * recip_window_size);