LTPDA_COHERE makes coherence estimates of the time-series objects in the input analysis objects. Coherences are computed using MATLAB's mscohere (>> help mscohere). Usage: b = ltpda_cohere(a1,a2,a3,...,pl) b - output analysis objects aN - input analysis objects (at least two) pl - input parameter list The function makes coherence estimates between a1 and all other input AOs. Therefore, if the input argument list contains N analysis objects, the output, b, will contain N-1 coherence estimates. If the last input argument is a parameter list (plist) it is used. The following parameters are recognised. Parameters: 'Win' - a specwin window object [default: Kaiser -200dB psll] 'Nolap' - segment overlap (number of samples) [default: taken from window function] 'Nfft' - number of samples in each fft [default: fs of input data] M Hewitson 07-02-07
0001 function varargout = ltpda_cohere(varargin) 0002 0003 % LTPDA_COHERE makes coherence estimates of the time-series 0004 % objects in the input analysis objects. Coherences are computed 0005 % using MATLAB's mscohere (>> help mscohere). 0006 % 0007 % 0008 % Usage: b = ltpda_cohere(a1,a2,a3,...,pl) 0009 % 0010 % b - output analysis objects 0011 % aN - input analysis objects (at least two) 0012 % pl - input parameter list 0013 % 0014 % The function makes coherence estimates between a1 and all other input AOs. 0015 % Therefore, if the input argument list contains N analysis objects, the 0016 % output, b, will contain N-1 coherence estimates. 0017 % 0018 % If the last input argument is a parameter list (plist) it is used. The 0019 % following parameters are recognised. 0020 % 0021 % Parameters: 0022 % 'Win' - a specwin window object [default: Kaiser -200dB psll] 0023 % 'Nolap' - segment overlap (number of samples) [default: taken from window function] 0024 % 'Nfft' - number of samples in each fft [default: fs of input data] 0025 % 0026 % M Hewitson 07-02-07 0027 % 0028 0029 ALGONAME = mfilename; 0030 VERSION = '$Id: ltpda_cohere.html,v 1.1 2007/06/08 14:15:10 hewitson Exp $'; 0031 0032 % Check if this is a call for parameters 0033 if nargin == 1 0034 in = char(varargin{1}); 0035 if strcmp(in, 'Params') 0036 varargout{1} = getDefaultPL(); 0037 return 0038 end 0039 end 0040 0041 % capture input variable names 0042 invars = {}; 0043 as = []; 0044 ps = []; 0045 for j=1:nargin 0046 invars = [invars cellstr(inputname(j))]; 0047 if isa(varargin{j}, 'ao') 0048 as = [as varargin{j}]; 0049 end 0050 if isa(varargin{j}, 'plist') 0051 ps = [ps varargin{j}]; 0052 end 0053 end 0054 0055 0056 % check plist 0057 if isempty(ps) 0058 pl = getDefaultPL(); 0059 else 0060 pl = combine(ps, getDefaultPL); 0061 end 0062 0063 varargout{1} = ltpda_xspec(as, pl, 'COHERE', ALGONAME, VERSION, invars); 0064 0065 0066 %-------------------------------------------------------------------------- 0067 % Get default params 0068 function plo = getDefaultPL() 0069 0070 disp('* creating default plist...'); 0071 plo = plist(); 0072 plo = append(plo, param('Nfft', -0.5)); 0073 plo = append(plo, param('Win', specwin('Kaiser', 1, 100))); 0074 plo = append(plo, param('Nolap', -1)); 0075 disp('* done.'); 0076 0077