annotate aim-mat/modules/bmm/pzfc/DetectFun.m @ 4:537f939baef0 tip

various bug fixes and changed copyright message
author Stefan Bleeck <bleeck@gmail.com>
date Tue, 16 Aug 2011 14:37:17 +0100
parents 74dedb26614d
children
rev   line source
tomwalters@0 1 function detect = DetectFun(velocity)
tomwalters@0 2 % function detect = DetectFun(velocity)
tomwalters@0 3 % a somewhat-compressing HWR.
tomwalters@0 4
tomwalters@0 5 negate = 0; % depending on filterbank parameters, one or other might "thump"
tomwalters@0 6 if negate
tomwalters@0 7 velocity = -velocity;
tomwalters@0 8 end
tomwalters@0 9
tomwalters@0 10 velocity(velocity < 0) = 0;
tomwalters@0 11 a = 0.25; % limiting slope, relative to 1 where it starts
tomwalters@0 12 detect = min(1, velocity);
tomwalters@0 13 detect = a*velocity + (1-a)*(detect - (detect.^3)/3);
tomwalters@0 14
tomwalters@0 15 % test it this way:
tomwalters@0 16 %plot(-1:.1:2, DetectFun(-1:.1:2))