view aim-mat/modules/bmm/pzfc/DetectFun.m @ 0:74dedb26614d

Initial checkin of AIM-MAT version 1.5 (6.4.2011).
author tomwalters
date Fri, 20 May 2011 12:32:31 +0100
parents
children
line wrap: on
line source
function detect = DetectFun(velocity)
% function detect = DetectFun(velocity)
% a somewhat-compressing HWR.

negate = 0; % depending on filterbank parameters, one or other might "thump"
if negate
    velocity = -velocity;
end

velocity(velocity < 0) = 0;
a = 0.25; % limiting slope, relative to 1 where it starts
detect = min(1, velocity);
detect = a*velocity + (1-a)*(detect - (detect.^3)/3);

% test it this way:
%plot(-1:.1:2, DetectFun(-1:.1:2))