diff trunk/matlab/bmm/carfac/CARFAC_Init.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 2964a3b4a00a
children 3dff17554c6d
line wrap: on
line diff
--- a/trunk/matlab/bmm/carfac/CARFAC_Init.m	Sun Apr 08 19:40:13 2012 +0000
+++ b/trunk/matlab/bmm/carfac/CARFAC_Init.m	Mon Apr 09 06:15:05 2012 +0000
@@ -81,13 +81,26 @@
 
 function state = IHC_Init_State(coeffs)
 n_ch = coeffs.n_ch;
-state = struct( ...
-  'ihc_accum', zeros(n_ch, 1), ...
-  'cap_voltage', coeffs.rest_cap * ones(n_ch, 1), ...
-  'cap1_voltage', coeffs.rest_cap1 * ones(n_ch, 1), ...
-  'cap2_voltage', coeffs.rest_cap2* ones(n_ch, 1), ...
-  'lpf1_state', coeffs.rest_output * ones(n_ch, 1), ...
-  'lpf2_state', coeffs.rest_output * ones(n_ch, 1) ...
-  );
+if coeffs.just_hwr
+  state = struct('ihc_accum', zeros(n_ch, 1));
+else
+  if coeffs.one_cap
+    state = struct( ...
+      'ihc_accum', zeros(n_ch, 1), ...
+      'cap_voltage', coeffs.rest_cap * ones(n_ch, 1), ...
+      'lpf1_state', coeffs.rest_output * ones(n_ch, 1), ...
+      'lpf2_state', coeffs.rest_output * ones(n_ch, 1) ...
+      );
+  else
+    state = struct( ...
+      'ihc_accum', zeros(n_ch, 1), ...
+      'cap1_voltage', coeffs.rest_cap1 * ones(n_ch, 1), ...
+      'cap2_voltage', coeffs.rest_cap2* ones(n_ch, 1), ...
+      'lpf1_state', coeffs.rest_output * ones(n_ch, 1), ...
+      'lpf2_state', coeffs.rest_output * ones(n_ch, 1) ...
+      );
+  end
+end
 
-  
+
+