view matlab/bmm/carfac/CARFAC_OHC_NLF.m @ 658:53a3f355bc4f

Factor out SAI_Run_Segment, and output test_data for comparison with C++ code.
author ronw@google.com
date Thu, 27 Jun 2013 22:28:42 +0000
parents db0e5e86fddd
children
line wrap: on
line source
% Copyright 2012, Google, Inc.
% Author: Richard F. Lyon
%
% This Matlab file is part of an implementation of Lyon's cochlear model:
% "Cascade of Asymmetric Resonators with Fast-Acting Compression"
% to supplement Lyon's upcoming book "Human and Machine Hearing"
%
% Licensed under the Apache License, Version 2.0 (the "License");
% you may not use this file except in compliance with the License.
% You may obtain a copy of the License at
%
%     http://www.apache.org/licenses/LICENSE-2.0
%
% Unless required by applicable law or agreed to in writing, software
% distributed under the License is distributed on an "AS IS" BASIS,
% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
% See the License for the specific language governing permissions and
% limitations under the License.

function nlf = CARFAC_OHC_NLF(velocities, CAR_coeffs)
% function nlf = CARFAC_OHC_NLF(velocities, CAR_coeffs)
% start with a quadratic nonlinear function, and limit it via a
% rational function; make the result go to zero at high
% absolute velocities, so it will do nothing there.

nlf = 1 ./ (1 + ...
  (velocities * CAR_coeffs.velocity_scale + CAR_coeffs.v_offset) .^ 2 );