Mercurial > hg > aimc
diff trunk/matlab/bmm/carfac/CARFAC_IHC_Step.m @ 556:910efa18d8f5
update how loop gain gets calculated, to remove dependency of AGC coeffs on IHC behavior, and speech up design by replacing iterations to convergence with DC models.
author | dicklyon@google.com |
---|---|
date | Mon, 09 Apr 2012 06:15:05 +0000 |
parents | 95a11cca4619 |
children | ab7fabe2af5d |
line wrap: on
line diff
--- a/trunk/matlab/bmm/carfac/CARFAC_IHC_Step.m Sun Apr 08 19:40:13 2012 +0000 +++ b/trunk/matlab/bmm/carfac/CARFAC_IHC_Step.m Mon Apr 09 06:15:05 2012 +0000 @@ -29,17 +29,15 @@ ihc_out = max(0, filters_out); state.ihc_accum = state.ihc_accum + ihc_out; else - one_cap = coeffs.one_cap; - - detect = CARFAC_Detect(filters_out); % detect with HWR or so - - if one_cap - ihc_out = detect .* state.cap_voltage; + conductance = CARFAC_Detect(filters_out); % detect with HWR or so + + if coeffs.one_cap; + ihc_out = conductance .* state.cap_voltage; state.cap_voltage = state.cap_voltage - ihc_out .* coeffs.out_rate + ... (1 - state.cap_voltage) .* coeffs.in_rate; else % change to 2-cap version more like Meddis's: - ihc_out = detect .* state.cap2_voltage; + ihc_out = conductance .* state.cap2_voltage; state.cap1_voltage = state.cap1_voltage - ... (state.cap1_voltage - state.cap2_voltage) .* coeffs.out1_rate + ... (1 - state.cap1_voltage) .* coeffs.in1_rate; @@ -56,7 +54,7 @@ state.lpf2_state = state.lpf2_state + coeffs.lpf_coeff * ... (state.lpf1_state - state.lpf2_state); - ihc_out = state.lpf2_state - coeffs.rest_output; - - state.ihc_accum = state.ihc_accum + max(0, ihc_out); + ihc_out = state.lpf2_state * coeffs.output_gain - coeffs.rest_output; + + state.ihc_accum = state.ihc_accum + ihc_out; % for where decimated output is useful end