diff trunk/matlab/bmm/carfac/CARFAC_IHC_Step.m @ 565:3e2e0ab4f708

Major update to how the DOHC works; like in recent book OHC chapter; Design Doc update (a bit)
author dicklyon@google.com
date Thu, 24 May 2012 22:26:56 +0000
parents ab7fabe2af5d
children
line wrap: on
line diff
--- a/trunk/matlab/bmm/carfac/CARFAC_IHC_Step.m	Sun May 20 22:36:47 2012 +0000
+++ b/trunk/matlab/bmm/carfac/CARFAC_IHC_Step.m	Thu May 24 22:26:56 2012 +0000
@@ -23,14 +23,15 @@
 % One sample-time update of inner-hair-cell (IHC) model, including the
 % detection nonlinearity and one or two capacitor state variables.
 
-just_hwr = coeffs.just_hwr;
+% AC couple the filters_out, with 20 Hz corner
+ac_diff = filters_out - state.ac_coupler;
+state.ac_coupler = state.ac_coupler + coeffs.ac_coeff * ac_diff;
 
-if just_hwr
-  ihc_out = min(2, max(0, filters_out));  % limit it for stability
-  state.ihc_accum = state.ihc_accum + ihc_out;
+if coeffs.just_hwr
+  ihc_out = min(2, max(0, ac_diff));  % limit it for stability
 else
-  conductance = CARFAC_Detect(filters_out);  % detect with HWR or so
-  
+  conductance = CARFAC_Detect(ac_diff);  % rectifying nonlinearity
+
   if coeffs.one_cap;
     ihc_out = conductance .* state.cap_voltage;
     state.cap_voltage = state.cap_voltage - ihc_out .* coeffs.out_rate + ...
@@ -54,5 +55,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 + ihc_out;  % for where decimated output is useful
 end
+
+state.ihc_accum = state.ihc_accum + ihc_out;  % for where decimated output is useful
+