Mercurial > hg > aimc
comparison 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 |
comparison
equal
deleted
inserted
replaced
564:9c4c3675c3f8 | 565:3e2e0ab4f708 |
---|---|
21 % function [ihc_out, state] = CARFAC_IHC_Step(filters_out, coeffs, state); | 21 % function [ihc_out, state] = CARFAC_IHC_Step(filters_out, coeffs, state); |
22 % | 22 % |
23 % One sample-time update of inner-hair-cell (IHC) model, including the | 23 % One sample-time update of inner-hair-cell (IHC) model, including the |
24 % detection nonlinearity and one or two capacitor state variables. | 24 % detection nonlinearity and one or two capacitor state variables. |
25 | 25 |
26 just_hwr = coeffs.just_hwr; | 26 % AC couple the filters_out, with 20 Hz corner |
27 ac_diff = filters_out - state.ac_coupler; | |
28 state.ac_coupler = state.ac_coupler + coeffs.ac_coeff * ac_diff; | |
27 | 29 |
28 if just_hwr | 30 if coeffs.just_hwr |
29 ihc_out = min(2, max(0, filters_out)); % limit it for stability | 31 ihc_out = min(2, max(0, ac_diff)); % limit it for stability |
30 state.ihc_accum = state.ihc_accum + ihc_out; | |
31 else | 32 else |
32 conductance = CARFAC_Detect(filters_out); % detect with HWR or so | 33 conductance = CARFAC_Detect(ac_diff); % rectifying nonlinearity |
33 | 34 |
34 if coeffs.one_cap; | 35 if coeffs.one_cap; |
35 ihc_out = conductance .* state.cap_voltage; | 36 ihc_out = conductance .* state.cap_voltage; |
36 state.cap_voltage = state.cap_voltage - ihc_out .* coeffs.out_rate + ... | 37 state.cap_voltage = state.cap_voltage - ihc_out .* coeffs.out_rate + ... |
37 (1 - state.cap_voltage) .* coeffs.in_rate; | 38 (1 - state.cap_voltage) .* coeffs.in_rate; |
38 else | 39 else |
52 state.lpf1_state = state.lpf1_state + coeffs.lpf_coeff * ... | 53 state.lpf1_state = state.lpf1_state + coeffs.lpf_coeff * ... |
53 (ihc_out - state.lpf1_state); | 54 (ihc_out - state.lpf1_state); |
54 state.lpf2_state = state.lpf2_state + coeffs.lpf_coeff * ... | 55 state.lpf2_state = state.lpf2_state + coeffs.lpf_coeff * ... |
55 (state.lpf1_state - state.lpf2_state); | 56 (state.lpf1_state - state.lpf2_state); |
56 ihc_out = state.lpf2_state - coeffs.rest_output; | 57 ihc_out = state.lpf2_state - coeffs.rest_output; |
57 state.ihc_accum = state.ihc_accum + ihc_out; % for where decimated output is useful | |
58 end | 58 end |
59 | |
60 state.ihc_accum = state.ihc_accum + ihc_out; % for where decimated output is useful | |
61 |