Mercurial > hg > aimc
diff trunk/matlab/bmm/carfac/CARFAC_Run.m @ 536:2964a3b4a00a
New design params, including narrower AGC, Greenwood map for more channels, default 71, some renaming, open loop feature, ...
author | dicklyon@google.com |
---|---|
date | Thu, 22 Mar 2012 22:37:56 +0000 |
parents | 95a11cca4619 |
children | 43c5664a00ec |
line wrap: on
line diff
--- a/trunk/matlab/bmm/carfac/CARFAC_Run.m Fri Mar 16 04:31:56 2012 +0000 +++ b/trunk/matlab/bmm/carfac/CARFAC_Run.m Thu Mar 22 22:37:56 2012 +0000 @@ -17,7 +17,7 @@ % See the License for the specific language governing permissions and % limitations under the License. -function [CF, decim_naps, naps] = CARFAC_Run ... +function [CF, decim_naps, naps, BM] = CARFAC_Run ... (CF, input_waves, AGC_plot_fig_num) % function [CF, decim_naps, naps] = CARFAC_Run ... % (CF, input_waves, AGC_plot_fig_num) @@ -50,6 +50,12 @@ AGC_plot_fig_num = 0; end +if nargout > 3 + BM = zeros(n_samp, n_ch, n_ears); +else + BM = []; +end + if n_ears ~= CF.n_ears error('bad number of input_waves channels passed to CARFAC_Run') end @@ -57,7 +63,7 @@ naps = zeros(n_samp, n_ch, n_ears); -seglen = 16; +seglen = 256; n_segs = ceil(n_samp / seglen); if nargout > 1 @@ -82,7 +88,18 @@ k_range = seglen*(seg_num - 1) + (1:seglen); end % Process a segment to get a slice of decim_naps, and plot AGC state: - [seg_naps, CF] = CARFAC_Run_Segment(CF, input_waves(k_range, :)); + if ~isempty(BM) + [seg_naps, CF, seg_BM] = CARFAC_Run_Segment(CF, input_waves(k_range, :)); + else + [seg_naps, CF] = CARFAC_Run_Segment(CF, input_waves(k_range, :)); + end + + if ~isempty(BM) + for ear = 1:n_ears + % Accumulate segment BM to make full BM + BM(k_range, :, ear) = seg_BM(:, :, ear); + end + end if ~isempty(naps) for ear = 1:n_ears @@ -109,11 +126,14 @@ for stage = 1:3; plot(2^(stage-1) * (CF.AGC_state(ear).AGC_memory(:, stage) - ... 2 * CF.AGC_state(ear).AGC_memory(:, stage+1))); + plot(2^(stage-1) * (CF.AGC_state(ear).AGC_memory(:, stage) - ... + 0 * CF.AGC_state(ear).AGC_memory(:, stage+1)), 'r--'); end stage = 4; plot(2^(stage-1) * CF.AGC_state(ear).AGC_memory(:, stage)); + plot(2^(stage-1) * CF.AGC_state(ear).AGC_memory(:, stage), 'r--'); end - axis([0, CF.n_ch+1, 0.0, max(maxes) + 0.01]); + axis([0, CF.n_ch+1, 0.0, max(maxes) * 1.01 + 0.002]); drawnow end