annotate trunk/matlab/bmm/carfac/CARFAC_Design.m @ 524:58d7d67bd138

Improve AGC coeffs design with better math
author dicklyon@google.com
date Wed, 07 Mar 2012 00:03:09 +0000
parents 2b96cb7ea4f7
children 1bd929f4bdcb
rev   line source
tom@516 1 % Copyright 2012, Google, Inc.
tom@516 2 % Author: Richard F. Lyon
tom@516 3 %
tom@516 4 % This Matlab file is part of an implementation of Lyon's cochlear model:
tom@516 5 % "Cascade of Asymmetric Resonators with Fast-Acting Compression"
tom@516 6 % to supplement Lyon's upcoming book "Human and Machine Hearing"
tom@516 7 %
tom@516 8 % Licensed under the Apache License, Version 2.0 (the "License");
tom@516 9 % you may not use this file except in compliance with the License.
tom@516 10 % You may obtain a copy of the License at
tom@516 11 %
tom@516 12 % http://www.apache.org/licenses/LICENSE-2.0
tom@516 13 %
tom@516 14 % Unless required by applicable law or agreed to in writing, software
tom@516 15 % distributed under the License is distributed on an "AS IS" BASIS,
tom@516 16 % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
tom@516 17 % See the License for the specific language governing permissions and
tom@516 18 % limitations under the License.
tom@516 19
tom@516 20 function CF = CARFAC_Design(fs, CF_filter_params, ...
tom@516 21 CF_AGC_params, ERB_break_freq, ERB_Q, CF_IHC_params)
tom@516 22 % function CF = CARFAC_Design(fs, CF_filter_params, ...
tom@516 23 % CF_AGC_params, ERB_break_freq, ERB_Q, CF_IHC_params)
tom@516 24 %
tom@516 25 % This function designs the CARFAC (Cascade of Asymmetric Resonators with
tom@516 26 % Fast-Acting Compression); that is, it take bundles of parameters and
tom@516 27 % computes all the filter coefficients needed to run it.
tom@516 28 %
tom@516 29 % fs is sample rate (per second)
tom@516 30 % CF_filter_params bundles all the pole-zero filter cascade parameters
tom@516 31 % CF_AGC_params bundles all the automatic gain control parameters
tom@516 32 % CF_IHC_params bundles all the inner hair cell parameters
tom@516 33 %
tom@516 34 % See other functions for designing and characterizing the CARFAC:
tom@516 35 % [naps, CF] = CARFAC_Run(CF, input_waves)
tom@516 36 % transfns = CARFAC_Transfer_Functions(CF, to_channels, from_channels)
tom@516 37 %
tom@516 38 % Defaults to Glasberg & Moore's ERB curve:
tom@516 39 % ERB_break_freq = 1000/4.37; % 228.833
tom@516 40 % ERB_Q = 1000/(24.7*4.37); % 9.2645
tom@516 41 %
tom@516 42 % All args are defaultable; for sample/default args see the code; they
tom@516 43 % make 96 channels at default fs = 22050, 114 channels at 44100.
tom@516 44
tom@516 45 if nargin < 6
tom@516 46 % HACK: these constant control the defaults
tom@516 47 one_cap = 0; % bool; 0 for new two-cap hack
tom@516 48 just_hwr = 0; % book; 0 for normal/fancy IHC; 1 for HWR
tom@516 49 if just_hwr
tom@516 50 CF_IHC_params = struct('just_hwr', 1); % just a simple HWR
tom@516 51 else
tom@516 52 if one_cap
tom@516 53 CF_IHC_params = struct( ...
dicklyon@523 54 'just_hwr', just_hwr, ... % not just a simple HWR
tom@516 55 'one_cap', one_cap, ... % bool; 0 for new two-cap hack
tom@516 56 'tau_lpf', 0.000080, ... % 80 microseconds smoothing twice
tom@516 57 'tau_out', 0.0005, ... % depletion tau is pretty fast
tom@516 58 'tau_in', 0.010 ); % recovery tau is slower
tom@516 59 else
tom@516 60 CF_IHC_params = struct( ...
dicklyon@523 61 'just_hwr', just_hwr, ... % not just a simple HWR
tom@516 62 'one_cap', one_cap, ... % bool; 0 for new two-cap hack
tom@516 63 'tau_lpf', 0.000080, ... % 80 microseconds smoothing twice
tom@516 64 'tau1_out', 0.020, ... % depletion tau is pretty fast
tom@516 65 'tau1_in', 0.020, ... % recovery tau is slower
tom@516 66 'tau2_out', 0.005, ... % depletion tau is pretty fast
tom@516 67 'tau2_in', 0.005 ); % recovery tau is slower
tom@516 68 end
tom@516 69 end
tom@516 70 end
tom@516 71
tom@516 72 if nargin < 5
tom@516 73 % Ref: Glasberg and Moore: Hearing Research, 47 (1990), 103-138
tom@516 74 % ERB = 24.7 * (1 + 4.37 * CF_Hz / 1000);
tom@516 75 ERB_Q = 1000/(24.7*4.37); % 9.2645
tom@516 76 if nargin < 4
tom@516 77 ERB_break_freq = 1000/4.37; % 228.833
tom@516 78 end
tom@516 79 end
tom@516 80
tom@516 81 if nargin < 3
tom@516 82 CF_AGC_params = struct( ...
tom@516 83 'n_stages', 4, ...
tom@516 84 'time_constants', [1, 4, 16, 64]*0.002, ...
tom@516 85 'AGC_stage_gain', 2, ... % gain from each stage to next slower stage
dicklyon@523 86 'decimation', [8, 2, 2, 2], ... % how often to update the AGC states
dicklyon@524 87 'AGC1_scales', [1, 2, 4, 6]*1, ... % in units of channels
dicklyon@524 88 'AGC2_scales', [1, 2, 4, 6]*1.5, ... % spread more toward base
tom@516 89 'detect_scale', 0.15, ... % the desired damping range
dicklyon@523 90 'AGC_mix_coeff', 0.5);
tom@516 91 end
tom@516 92
tom@516 93 if nargin < 2
tom@516 94 CF_filter_params = struct( ...
dicklyon@523 95 'velocity_scale', 0.2, ... % for the "cubic" velocity nonlinearity
dicklyon@523 96 'v_offset', 0.01, ... % offset gives a quadratic part
dicklyon@523 97 'v2_corner', 0.2, ... % corner for essential nonlin
dicklyon@523 98 'v_damp_max', 0.01, ... % damping delta damping from velocity nonlin
tom@516 99 'min_zeta', 0.12, ...
tom@516 100 'first_pole_theta', 0.78*pi, ...
tom@516 101 'zero_ratio', sqrt(2), ...
tom@516 102 'ERB_per_step', 0.3333, ... % assume G&M's ERB formula
tom@516 103 'min_pole_Hz', 40 );
tom@516 104 end
tom@516 105
tom@516 106 if nargin < 1
tom@516 107 fs = 22050;
tom@516 108 end
tom@516 109
tom@516 110 % first figure out how many filter stages (PZFC/CARFAC channels):
tom@516 111 pole_Hz = CF_filter_params.first_pole_theta * fs / (2*pi);
tom@516 112 n_ch = 0;
tom@516 113 while pole_Hz > CF_filter_params.min_pole_Hz
tom@516 114 n_ch = n_ch + 1;
tom@516 115 pole_Hz = pole_Hz - CF_filter_params.ERB_per_step * ...
tom@516 116 ERB_Hz(pole_Hz, ERB_break_freq, ERB_Q);
tom@516 117 end
tom@516 118 % Now we have n_ch, the number of channels, so can make the array
tom@516 119 % and compute all the frequencies again to put into it:
tom@516 120 pole_freqs = zeros(n_ch, 1);
tom@516 121 pole_Hz = CF_filter_params.first_pole_theta * fs / (2*pi);
tom@516 122 for ch = 1:n_ch
tom@516 123 pole_freqs(ch) = pole_Hz;
tom@516 124 pole_Hz = pole_Hz - CF_filter_params.ERB_per_step * ...
tom@516 125 ERB_Hz(pole_Hz, ERB_break_freq, ERB_Q);
tom@516 126 end
tom@516 127 % now we have n_ch, the number of channels, and pole_freqs array
tom@516 128
tom@516 129 CF = struct( ...
tom@516 130 'fs', fs, ...
tom@516 131 'filter_params', CF_filter_params, ...
tom@516 132 'AGC_params', CF_AGC_params, ...
tom@516 133 'IHC_params', CF_IHC_params, ...
tom@516 134 'n_ch', n_ch, ...
tom@516 135 'pole_freqs', pole_freqs, ...
tom@516 136 'filter_coeffs', CARFAC_DesignFilters(CF_filter_params, fs, pole_freqs), ...
tom@516 137 'AGC_coeffs', CARFAC_DesignAGC(CF_AGC_params, fs), ...
tom@516 138 'IHC_coeffs', CARFAC_DesignIHC(CF_IHC_params, fs), ...
tom@516 139 'n_mics', 0 );
tom@516 140
tom@516 141 % adjust the AGC_coeffs to account for IHC saturation level to get right
tom@516 142 % damping change as specified in CF.AGC_params.detect_scale
tom@516 143 CF.AGC_coeffs.detect_scale = CF.AGC_params.detect_scale / ...
tom@516 144 (CF.IHC_coeffs.saturation_output * CF.AGC_coeffs.AGC_gain);
tom@516 145
tom@516 146 %% Design the filter coeffs:
tom@516 147 function filter_coeffs = CARFAC_DesignFilters(filter_params, fs, pole_freqs)
tom@516 148
tom@516 149 n_ch = length(pole_freqs);
tom@516 150
tom@516 151 % the filter design coeffs:
tom@516 152
dicklyon@523 153 filter_coeffs = struct('velocity_scale', filter_params.velocity_scale, ...
dicklyon@523 154 'v_offset', filter_params.v_offset, ...
dicklyon@523 155 'v2_corner', filter_params.v2_corner, ...
dicklyon@523 156 'v_damp_max', filter_params.v_damp_max ...
dicklyon@523 157 );
tom@516 158
tom@516 159 filter_coeffs.r_coeffs = zeros(n_ch, 1);
tom@516 160 filter_coeffs.a_coeffs = zeros(n_ch, 1);
tom@516 161 filter_coeffs.c_coeffs = zeros(n_ch, 1);
tom@516 162 filter_coeffs.h_coeffs = zeros(n_ch, 1);
tom@516 163 filter_coeffs.g_coeffs = zeros(n_ch, 1);
tom@516 164
tom@516 165 % zero_ratio comes in via h. In book's circuit D, zero_ratio is 1/sqrt(a),
tom@516 166 % and that a is here 1 / (1+f) where h = f*c.
tom@516 167 % solve for f: 1/zero_ratio^2 = 1 / (1+f)
tom@516 168 % zero_ratio^2 = 1+f => f = zero_ratio^2 - 1
tom@516 169 f = filter_params.zero_ratio^2 - 1; % nominally 1 for half-octave
tom@516 170
tom@516 171 % Make pole positions, s and c coeffs, h and g coeffs, etc.,
tom@516 172 % which mostly depend on the pole angle theta:
tom@516 173 theta = pole_freqs .* (2 * pi / fs);
tom@516 174
tom@516 175 % different possible interpretations for min-damping r:
tom@516 176 % r = exp(-theta * CF_filter_params.min_zeta).
tom@516 177 % Using sin gives somewhat higher Q at highest thetas.
tom@516 178 r = (1 - sin(theta) * filter_params.min_zeta);
tom@516 179 filter_coeffs.r_coeffs = r;
tom@516 180
tom@516 181 % undamped coupled-form coefficients:
tom@516 182 filter_coeffs.a_coeffs = cos(theta);
tom@516 183 filter_coeffs.c_coeffs = sin(theta);
tom@516 184
tom@516 185 % the zeros follow via the h_coeffs
tom@516 186 h = sin(theta) .* f;
tom@516 187 filter_coeffs.h_coeffs = h;
tom@516 188
dicklyon@524 189 % unity gain at min damping, radius r:
dicklyon@524 190 filter_coeffs.g_coeffs = (1 - 2*r.*cos(theta) + r.^2) ./ ...
dicklyon@524 191 (1 - 2*r .* cos(theta) + h .* r .* sin(theta) + r.^2);
tom@516 192
tom@516 193
tom@516 194 %% the AGC design coeffs:
tom@516 195 function AGC_coeffs = CARFAC_DesignAGC(AGC_params, fs)
tom@516 196
dicklyon@523 197 AGC_coeffs = struct('AGC_stage_gain', AGC_params.AGC_stage_gain);
tom@516 198
tom@516 199 % AGC1 pass is smoothing from base toward apex;
tom@516 200 % AGC2 pass is back, which is done first now
tom@516 201 AGC1_scales = AGC_params.AGC1_scales;
tom@516 202 AGC2_scales = AGC_params.AGC2_scales;
tom@516 203
tom@516 204 n_AGC_stages = AGC_params.n_stages;
tom@516 205 AGC_coeffs.AGC_epsilon = zeros(1, n_AGC_stages); % the 1/(tau*fs) roughly
dicklyon@523 206 decim = 1;
dicklyon@523 207 AGC_coeffs.decimation = AGC_params.decimation;
dicklyon@523 208
dicklyon@523 209 total_DC_gain = 0;
tom@516 210 for stage = 1:n_AGC_stages
tom@516 211 tau = AGC_params.time_constants(stage);
dicklyon@523 212 decim = decim * AGC_params.decimation(stage);
tom@516 213 % epsilon is how much new input to take at each update step:
tom@516 214 AGC_coeffs.AGC_epsilon(stage) = 1 - exp(-decim / (tau * fs));
tom@516 215 % and these are the smoothing scales and poles for decimated rate:
dicklyon@523 216
dicklyon@523 217 n_iterations = 1; % how many times to apply smoothing filter in a stage
dicklyon@523 218 % effective number of smoothings in a time constant:
dicklyon@524 219 ntimes = n_iterations * tau * (fs / decim);
dicklyon@524 220
dicklyon@524 221 % decide on target spread (variance) and delay (mean) of impulse
dicklyon@524 222 % response as a distribution to be convolved ntimes:
dicklyon@524 223 delay = (AGC2_scales(stage) - AGC1_scales(stage)) / ntimes;
dicklyon@524 224 spread_sq = (AGC1_scales(stage)^2 + AGC2_scales(stage)^2) / ntimes;
dicklyon@524 225
dicklyon@524 226 % get pole positions to better match intended spread and delay:
dicklyon@524 227 u = 1 + 1 / spread_sq; % these are based on off-line algebra hacking.
dicklyon@524 228 p = u - sqrt(u^2 - 1); % pole that would give spread if used twice.
dicklyon@524 229 dp = delay * (1 - 2*p +p^2)/2;
dicklyon@524 230 polez1 = p - dp;
dicklyon@524 231 polez2 = p + dp;
dicklyon@523 232 AGC_coeffs.AGC_polez1(stage) = polez1;
dicklyon@523 233 AGC_coeffs.AGC_polez2(stage) = polez2;
dicklyon@523 234
dicklyon@524 235 % from [[Geometric distribution]] mean and variance from wikipedia,
dicklyon@524 236 % to verify that we got what we intended, very nearly, and make the
dicklyon@524 237 % FIR version to match the poles version:
dicklyon@524 238 % delay = polez2/(1-polez2) - polez1/(1-polez1);
dicklyon@524 239 % spread_sq = polez1/(1-polez1)^2 + polez2/(1-polez2)^2;
dicklyon@523 240
dicklyon@523 241 % try a 3-tap FIR as an alternative:
dicklyon@523 242 n_taps = 3;
dicklyon@523 243 a = (spread_sq + delay*delay - delay) / 2;
dicklyon@523 244 b = (spread_sq + delay*delay + delay) / 2;
dicklyon@523 245 AGC_spatial_FIR = [a, 1 - a - b, b]; % stored as 5 taps
dicklyon@523 246 done = AGC_spatial_FIR(2) > 0.1; % not OK if center tap is too low
dicklyon@523 247 % if 1 iteration is not good with 3 taps go to 5 taps, then more
dicklyon@524 248 % iterations if needed, and maybe fall back to double-exponential IIR:
dicklyon@524 249 spread_sq1 = spread_sq; % keep this as 1-iteration spread reference...
dicklyon@524 250 delay1 = delay; % keep this as 1-iteration delay reference...
dicklyon@523 251 while ~done % smoothing condition, middle value
dicklyon@523 252 if n_taps == 3
dicklyon@523 253 % first time through, go wider but stick to 1 iteration
dicklyon@523 254 n_taps = 5;
dicklyon@523 255 n_iterations = 1;
dicklyon@523 256 else
dicklyon@523 257 % already at 5 taps, so just increase iterations
dicklyon@523 258 n_iterations = n_iterations + 1; % number of times to apply spatial
dicklyon@523 259 end
dicklyon@524 260 spread_sq = spread_sq1 / n_iterations;
dicklyon@524 261 delay = delay1 / n_iterations;
dicklyon@523 262 % 5-tap design duplicates the a and b coeffs; stores just 3 coeffs:
dicklyon@523 263 % a and b from their sum and diff as before: (sum \pm diff) / 2:
dicklyon@523 264 a = ((spread_sq + delay*delay)*2/5 - delay*2/3) / 2;
dicklyon@523 265 b = ((spread_sq + delay*delay)*2/5 + delay*2/3) / 2;
dicklyon@523 266 AGC_spatial_FIR = [a/2, 1 - a - b, b/2]; % implicit dup of a and b
dicklyon@523 267 done = AGC_spatial_FIR(2) > 0.1;
dicklyon@523 268 end
dicklyon@523 269 % store the resulting FIR design in coeffs:
dicklyon@523 270 AGC_coeffs.AGC_spatial_iterations(stage) = n_iterations;
dicklyon@523 271 AGC_coeffs.AGC_spatial_FIR(:,stage) = AGC_spatial_FIR;
dicklyon@523 272 AGC_coeffs.AGC_n_taps(stage) = n_taps;
dicklyon@523 273
dicklyon@523 274 total_DC_gain = total_DC_gain + AGC_params.AGC_stage_gain^(stage-1);
dicklyon@523 275
dicklyon@523 276 % TODO (dicklyon) -- is this what we want?
dicklyon@523 277 if stage == 1
dicklyon@523 278 AGC_coeffs.AGC_mix_coeffs(stage) = 0;
dicklyon@523 279 else
dicklyon@523 280 AGC_coeffs.AGC_mix_coeffs(stage) = AGC_params.AGC_mix_coeff / ...
dicklyon@523 281 (tau * (fs / decim));
dicklyon@523 282 end
tom@516 283 end
tom@516 284
dicklyon@524 285 AGC_coeffs.AGC_gain = total_DC_gain;
dicklyon@523 286
dicklyon@524 287 % print some results
dicklyon@524 288 AGC_coeffs
dicklyon@524 289 AGC_spatial_FIR = AGC_coeffs.AGC_spatial_FIR
dicklyon@523 290
tom@516 291
tom@516 292 %% the IHC design coeffs:
tom@516 293 function IHC_coeffs = CARFAC_DesignIHC(IHC_params, fs)
tom@516 294
tom@516 295 if IHC_params.just_hwr
tom@516 296 IHC_coeffs = struct('just_hwr', 1);
tom@516 297 IHC_coeffs.saturation_output = 10; % HACK: assume some max out
tom@516 298 else
tom@516 299 if IHC_params.one_cap
tom@516 300 IHC_coeffs = struct(...
tom@516 301 'just_hwr', 0, ...
tom@516 302 'lpf_coeff', 1 - exp(-1/(IHC_params.tau_lpf * fs)), ...
tom@516 303 'out_rate', 1 / (IHC_params.tau_out * fs), ...
tom@516 304 'in_rate', 1 / (IHC_params.tau_in * fs), ...
tom@516 305 'one_cap', IHC_params.one_cap);
tom@516 306 else
tom@516 307 IHC_coeffs = struct(...
tom@516 308 'just_hwr', 0, ...
tom@516 309 'lpf_coeff', 1 - exp(-1/(IHC_params.tau_lpf * fs)), ...
tom@516 310 'out1_rate', 1 / (IHC_params.tau1_out * fs), ...
tom@516 311 'in1_rate', 1 / (IHC_params.tau1_in * fs), ...
tom@516 312 'out2_rate', 1 / (IHC_params.tau2_out * fs), ...
tom@516 313 'in2_rate', 1 / (IHC_params.tau2_in * fs), ...
tom@516 314 'one_cap', IHC_params.one_cap);
tom@516 315 end
tom@516 316
tom@516 317 % run one channel to convergence to get rest state:
tom@516 318 IHC_coeffs.rest_output = 0;
tom@516 319 IHC_state = struct( ...
tom@516 320 'cap_voltage', 0, ...
tom@516 321 'cap1_voltage', 0, ...
tom@516 322 'cap2_voltage', 0, ...
tom@516 323 'lpf1_state', 0, ...
tom@516 324 'lpf2_state', 0, ...
tom@516 325 'ihc_accum', 0);
tom@516 326
tom@516 327 IHC_in = 0;
tom@516 328 for k = 1:30000
tom@516 329 [IHC_out, IHC_state] = CARFAC_IHCStep(IHC_in, IHC_coeffs, IHC_state);
tom@516 330 end
tom@516 331
tom@516 332 IHC_coeffs.rest_output = IHC_out;
tom@516 333 IHC_coeffs.rest_cap = IHC_state.cap_voltage;
tom@516 334 IHC_coeffs.rest_cap1 = IHC_state.cap1_voltage;
tom@516 335 IHC_coeffs.rest_cap2 = IHC_state.cap2_voltage;
tom@516 336
tom@516 337 LARGE = 2;
tom@516 338 IHC_in = LARGE; % "Large" saturating input to IHC; make it alternate
tom@516 339 for k = 1:30000
tom@516 340 [IHC_out, IHC_state] = CARFAC_IHCStep(IHC_in, IHC_coeffs, IHC_state);
tom@516 341 prev_IHC_out = IHC_out;
tom@516 342 IHC_in = -IHC_in;
tom@516 343 end
tom@516 344
tom@516 345 IHC_coeffs.saturation_output = (IHC_out + prev_IHC_out) / 2;
tom@516 346 end
tom@516 347
tom@516 348 %%
tom@516 349 % default design result, running this function with no args, should look
tom@516 350 % like this, before CARFAC_Init puts state storage into it:
tom@516 351 %
dicklyon@523 352 %
tom@516 353 % CF = CARFAC_Design
tom@516 354 % CF.filter_params
tom@516 355 % CF.AGC_params
tom@516 356 % CF.filter_coeffs
tom@516 357 % CF.AGC_coeffs
tom@516 358 % CF.IHC_coeffs
tom@516 359 %
tom@516 360 % CF =
tom@516 361 % fs: 22050
tom@516 362 % filter_params: [1x1 struct]
tom@516 363 % AGC_params: [1x1 struct]
tom@516 364 % IHC_params: [1x1 struct]
tom@516 365 % n_ch: 96
tom@516 366 % pole_freqs: [96x1 double]
tom@516 367 % filter_coeffs: [1x1 struct]
tom@516 368 % AGC_coeffs: [1x1 struct]
tom@516 369 % IHC_coeffs: [1x1 struct]
tom@516 370 % n_mics: 0
tom@516 371 % ans =
tom@516 372 % velocity_scale: 0.2000
dicklyon@523 373 % v_offset: 0.0100
dicklyon@523 374 % v2_corner: 0.2000
dicklyon@523 375 % v_damp_max: 0.0100
tom@516 376 % min_zeta: 0.1200
tom@516 377 % first_pole_theta: 2.4504
tom@516 378 % zero_ratio: 1.4142
tom@516 379 % ERB_per_step: 0.3333
tom@516 380 % min_pole_Hz: 40
tom@516 381 % ans =
tom@516 382 % n_stages: 4
tom@516 383 % time_constants: [0.0020 0.0080 0.0320 0.1280]
tom@516 384 % AGC_stage_gain: 2
dicklyon@523 385 % decimation: [8 2 2 2]
dicklyon@523 386 % AGC1_scales: [1 2 4 8]
dicklyon@523 387 % AGC2_scales: [1.5000 3 6 12]
tom@516 388 % detect_scale: 0.1500
dicklyon@523 389 % AGC_mix_coeff: 0.3500
tom@516 390 % ans =
tom@516 391 % velocity_scale: 0.2000
dicklyon@523 392 % v_offset: 0.0100
dicklyon@523 393 % v2_corner: 0.2000
dicklyon@523 394 % v_damp_max: 0.0100
tom@516 395 % r_coeffs: [96x1 double]
tom@516 396 % a_coeffs: [96x1 double]
tom@516 397 % c_coeffs: [96x1 double]
tom@516 398 % h_coeffs: [96x1 double]
tom@516 399 % g_coeffs: [96x1 double]
tom@516 400 % ans =
dicklyon@523 401 % AGC_stage_gain: 2
dicklyon@523 402 % AGC_epsilon: [0.1659 0.0867 0.0443 0.0224]
dicklyon@523 403 % decimation: [8 2 2 2]
dicklyon@523 404 % AGC_spatial_iterations: [1 1 2 3]
dicklyon@523 405 % AGC_spatial_FIR: [3x4 double]
dicklyon@523 406 % AGC_n_taps: [3 5 5 5]
dicklyon@523 407 % AGC_mix_coeffs: [0 0.0317 0.0159 0.0079]
dicklyon@523 408 % AGC_gain: 15
dicklyon@523 409 % detect_scale: 0.0664
tom@516 410 % ans =
dicklyon@523 411 % just_hwr: 0
tom@516 412 % lpf_coeff: 0.4327
tom@516 413 % out1_rate: 0.0023
tom@516 414 % in1_rate: 0.0023
tom@516 415 % out2_rate: 0.0091
tom@516 416 % in2_rate: 0.0091
tom@516 417 % one_cap: 0
tom@516 418 % rest_output: 0.0365
tom@516 419 % rest_cap: 0
tom@516 420 % rest_cap1: 0.9635
tom@516 421 % rest_cap2: 0.9269
dicklyon@523 422 % saturation_output: 0.1507
tom@516 423
tom@516 424
tom@516 425