annotate aim-mat/tools/@signal/erb2log.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 20ada0af3d7d
children
rev   line source
tomwalters@0 1 % method of class @signal
tomwalters@0 2 % function sig=erb2log(sig,cfs)
tomwalters@0 3 %
tomwalters@0 4 % changes the signal (that is ususally a function of frequencies, into
tomwalters@0 5 % another signal with frequencies, but now the spacing is according to the
tomwalters@0 6 % cf list in cfs. All points are interpolated
tomwalters@0 7 %
tomwalters@0 8 % INPUT VALUES:
tomwalters@0 9 % sig: original @signal
tomwalters@0 10 % cfs: list of frequencies
tomwalters@0 11 %
tomwalters@0 12 % RETURN VALUE:
tomwalters@0 13 % sig: new @signal
tomwalters@0 14 %
bleeck@3 15 % This external file is included as part of the 'aim-mat' distribution package
bleeck@3 16 % (c) 2011, University of Southampton
bleeck@3 17 % Maintained by Stefan Bleeck (bleeck@gmail.com)
bleeck@3 18 % download of current version is on the soundsoftware site:
bleeck@3 19 % http://code.soundsoftware.ac.uk/projects/aimmat
bleeck@3 20 % documentation and everything is on http://www.acousticscale.org
bleeck@3 21
tomwalters@0 22
tomwalters@0 23 function sig=erb2log(sig,cfs)
tomwalters@0 24
tomwalters@0 25
tomwalters@0 26 min_fre=cfs(1);
tomwalters@0 27 max_fre=cfs(end);
tomwalters@0 28 nr_points=length(cfs);
tomwalters@0 29
tomwalters@0 30 log_fres=distributelogarithmic(min_fre,max_fre,nr_points);
tomwalters@0 31
tomwalters@0 32 erb_fres=cfs;
tomwalters@0 33 erb_vals=sig.werte;
tomwalters@0 34
tomwalters@0 35 method='cubic';
tomwalters@0 36 % for i=1:nr_points
tomwalters@0 37 % log_fre=log_fres(i);
tomwalters@0 38 new_vals=interp1(erb_fres,erb_vals,log_fres,method);
tomwalters@0 39
tomwalters@0 40
tomwalters@0 41 % end
tomwalters@0 42
tomwalters@0 43 sig=setvalues(sig,new_vals);
tomwalters@0 44
tomwalters@0 45 a=0;
tomwalters@0 46
tomwalters@0 47
tomwalters@0 48