diff matlab/bmm/carfac/CARFAC_CAR_Step.m @ 502:37c007925536

Separate the OHC nonlinear function into new file CARFAC_OHC_NLF.m. Update Design doc a bit. Add optional outputs and hacks that I used with Roy to look at distortion effects in OHC.
author dicklyon@google.com
date Sat, 12 May 2012 04:31:59 +0000
parents 52f659be9008
children a0869cb1c99b
line wrap: on
line diff
--- a/matlab/bmm/carfac/CARFAC_CAR_Step.m	Tue May 01 23:32:24 2012 +0000
+++ b/matlab/bmm/carfac/CARFAC_CAR_Step.m	Sat May 12 04:31:59 2012 +0000
@@ -29,9 +29,6 @@
 zB = state.zB_memory + state.dzB_memory; % AGC interpolation
 r1 = CAR_coeffs.r1_coeffs;
 g = state.g_memory + state.dg_memory;  % interp g
-v_offset  = CAR_coeffs.v_offset;
-v2_corner = CAR_coeffs.v2_corner;
-v_damp_max = CAR_coeffs.v_damp_max;
 
 % zB and zA are "extra damping", and multiply zr (compressed theta):
 r = r1 - CAR_coeffs.zr_coeffs .* (zA + zB); 
@@ -43,11 +40,8 @@
 z2 = r .* (CAR_coeffs.c0_coeffs .* state.z1_memory + ...
   CAR_coeffs.a0_coeffs .* state.z2_memory);
 
-% update the "velocity" for cubic nonlinearity, into zA:
-zA = (((state.z2_memory - z2) .* CAR_coeffs.velocity_scale) + ...
-  v_offset) .^ 2;
-% soft saturation to make it more like an "essential" nonlinearity:
-zA = v_damp_max * zA ./ (v2_corner + zA);
+% update the nonlinear function of "velocity", into zA:
+zA = CARFAC_OHC_NLF(state.z2_memory - z2, CAR_coeffs);
 
 zY = CAR_coeffs.h_coeffs .* z2;  % partial output