From 46b2a025f9e2e152cbd9e6b836412d75ba01beaa Mon Sep 17 00:00:00 2001 From: Hagen Wierstorf Date: Wed, 11 Sep 2013 10:44:12 +0200 Subject: [PATCH] Fixed a critical wfs_preequalization() bug. Before the filter does not work properly for ir_wfs(). Note that this bug was newly introduced for the 1.0.0 version and worked fine in older versions --- SFS_time_domain/sound_field_imp_wfs.m | 7 +++++++ SFS_time_domain/wfs_preequalization.m | 3 --- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/SFS_time_domain/sound_field_imp_wfs.m b/SFS_time_domain/sound_field_imp_wfs.m index f3bc8f9a..79bd806a 100644 --- a/SFS_time_domain/sound_field_imp_wfs.m +++ b/SFS_time_domain/sound_field_imp_wfs.m @@ -87,6 +87,7 @@ else greens_function = 'ps'; end +usehpre = conf.wfs.usehpre; %% ===== Computation ===================================================== @@ -96,6 +97,12 @@ x0 = secondary_source_tapering(x0,conf); % Get driving signals d = driving_function_imp_wfs(x0,xs,src,conf); +% Fix the time to account for sample offset of the pre-equalization filter +if usehpre + % add a time offset due to the filter (the filter has 128 coefficients, + % hence the offset is 64 samples) + t = t + 64; +end % Calculate sound field [varargout{1:min(nargout,4)}] = ... sound_field_imp(X,Y,Z,x0,greens_function,d,t,conf); diff --git a/SFS_time_domain/wfs_preequalization.m b/SFS_time_domain/wfs_preequalization.m index c01c90cb..010d208d 100644 --- a/SFS_time_domain/wfs_preequalization.m +++ b/SFS_time_domain/wfs_preequalization.m @@ -78,9 +78,6 @@ hpre = wfs_fir_prefilter(conf); % apply filter ir = convolution(hpre,ir); - % remove time offset due to the filter (the filter has 128 coefficients, - % hence we can remove 64 samples at the beginning) - ir = ir(65:end,:); elseif strcmp('IIR',hpretype) % get IIR filter hpre = wfs_iir_prefilter(conf);