view aim-mat/tools/@frame/logcompress.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
line wrap: on
line source
% method of class @frame
% 
%   INPUT VALUES:
%  
%   RETURN VALUE:
%
% 
% (c) 2003, University of Cambridge, Medical Research Council 
% Stefan Bleeck (stefan@bleeck.de)
% http://www.mrc-cbu.cam.ac.uk/cnbh/aimmanual
% $Date: 2003/03/13 14:48:22 $
% $Revision: 1.6 $

function nap=logcompress(nap,options)

%if nargin <2
%    options.dynamic_range=50;
%end

nap=halfwayrectify(nap);
vals=getvalues(nap);

%gtfb output values are: 0< gt_vals <1
%therefore we will scale for 16bit values
%operationally only 15 bits are used as we
%half wave rectify
vals=vals.*2.^15;

%avoid log problems by making everything > 1
vals(find(vals<1))=1;
vals=20.*log10(vals);


nap=setvalues(nap,vals);