From f3ef50ac423cb85a8f5fa94f4bb67d725806f4f8 Mon Sep 17 00:00:00 2001 From: temertylab Date: Thu, 16 Jan 2025 17:40:38 -0500 Subject: [PATCH] Fixes example by defining IIR Butterworth filter for comparison with non-causal method. --- toolbox/examples/demo_phase_prediction_error_simple.m | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/toolbox/examples/demo_phase_prediction_error_simple.m b/toolbox/examples/demo_phase_prediction_error_simple.m index c4323a5..88eb13a 100644 --- a/toolbox/examples/demo_phase_prediction_error_simple.m +++ b/toolbox/examples/demo_phase_prediction_error_simple.m @@ -57,11 +57,13 @@ %% Phase error using standard non-causal methods disp('Determining phase using standard non-causal methods...'); -% Obtain applied filter -oscBPFcoeffs = bd.getparam('OSC/alpha', 'bpf_fir_coeffs'); +% Prepare IIR Butterworth filter +peakFrequency = 10; +oscBPFfilter = designfilt('bandpassiir','FilterOrder',12,'HalfPowerFrequency1',peakFrequency-2,... + 'HalfPowerFrequency2',peakFrequency+2,'SampleRate',osc_alpha_ip.Properties.SampleRate,'DesignMethod','butter'); % Compute phase prediction error -[phaseError, meanError, meanDev] = bossapi.boss.computePhasePredictionError(oscBPFcoeffs,... +[phaseError, meanError, meanDev] = bossapi.boss.computePhasePredictionError(oscBPFfilter,... syncedData.spf_sig_idx1(1+numSamples:end-1), syncedData.osc_idx1(2:end-numSamples)); disp('Done.');