annotate orthohandle.m @ 17:0da5eb32e49d tip

minor changes
author Daniele Barchiesi <daniele.barchiesi@eecs.qmul.ac.uk>
date Thu, 10 Nov 2011 15:53:06 +0000
parents 88af68016e8a
children
rev   line source
danieleb@8 1 function orthoFun = orthohandle(orthoBasis,dir)
danieleb@15 2 % ORTHOHANDLE local orthogonal transform string to function handle
danieleb@9 3 %
danieleb@14 4 % Example
danieleb@9 5 % orthoFun = orthohandle(orthoBasis,dir)
danieleb@9 6 %
danieleb@14 7 % Input
danieleb@9 8 % - orthoBasis: either a string or a function handle corresponding to an
danieleb@9 9 % orhogonal transform to be used in each overlapping window. The available
danieleb@9 10 % forward transforms are
danieleb@9 11 % 'mdct': modified discrete transform, uses local DCT-IV and DCT-I for
danieleb@9 12 % last block of data.
danieleb@9 13 % 'fft': Fourier transform
danieleb@9 14 % 'id': Identity
danieleb@9 15 %
danieleb@9 16 % - dir: either 'for' or 'inv' for the forward and inverse transform
danieleb@9 17 % respectively.
danieleb@9 18 %
danieleb@14 19 % Output
danieleb@9 20 % - orthoFun: handle to the orthogonal function
danieleb@9 21 %
danieleb@14 22 % Reference
danieleb@9 23 % S. Mallat, A Wavelet Tour of Signal Processing
danieleb@9 24 %
danieleb@14 25 % See also LOT, ILOT
danieleb@9 26
danieleb@9 27 % Author(s): Daniele Barchiesi
danieleb@14 28 % Copyright 2011-2011
danieleb@9 29
danieleb@9 30 if ischar(orthoBasis) %if string parse input
danieleb@9 31 if strcmpi(dir,'for') %forward transform
danieleb@8 32 switch orthoBasis
danieleb@8 33 case 'mdct'
danieleb@8 34 orthoFun = @(x) dcti(x,'IV');
danieleb@8 35 case 'id'
danieleb@8 36 orthoFun = @(x) x;
danieleb@8 37 case 'fft'
danieleb@8 38 orthoFun = @(x) fft(x);
danieleb@8 39 otherwise
danieleb@8 40 error('invalid basis function');
danieleb@8 41 end
danieleb@9 42 elseif strcmpi(dir,'inv') %inverse transform
danieleb@8 43 switch orthoBasis
danieleb@8 44 case 'mdct'
danieleb@8 45 orthoFun = @(y) idcti(y,'IV');
danieleb@8 46 case 'id'
danieleb@8 47 orthoFun = @(y) y;
danieleb@8 48 case 'fft'
danieleb@8 49 orthoFun = @(y) ifft(y);
danieleb@8 50 otherwise
danieleb@8 51 error('invalid basis function');
danieleb@8 52 end
danieleb@8 53 end
danieleb@9 54 elseif isa(orthoBasis,'function_handle') %if function handle do nothing
danieleb@9 55 orthoFun = orthoBasis;
danieleb@9 56 else
danieleb@9 57 error('invalid basis function');
danieleb@8 58 end