LTPDA_COHERE makes coherence estimates of the time-series objects %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: LTPDA_COHERE makes coherence estimates of the time-series objects in the input analysis objects. Coherences are computed using MATLAB's mscohere (>> help mscohere). CALL: b = ltpda_cohere(a1,a2,a3,...,pl) INPUTS: b - output analysis objects aN - input analysis objects (at least two) pl - input parameter list The function makes coherence estimates between all input AOs. Therefore, if the input argument list contains N analysis objects, the output, b, will contain NXN 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] Olap - segment percent overlap [default: taken from window function] Nfft - number of samples in each fft [default: half length of input data] Order - order of detrending. -1 - no detrending 0 - subtract mean [default] 1 - subtract linear fit N - subtract fit of polynomial, order N VERSION: $Id: ltpda_cohere.html,v 1.14 2008/03/31 10:27:39 hewitson Exp $ HISTORY: 07-02-2007 M Hewitson Creation The following call returns a parameter list object that contains the default parameter values: >> pl = ltpda_cohere('Params') The following call returns a string that contains the routine CVS version: >> version = ltpda_cohere('Version') The following call returns a string that contains the routine category: >> category = ltpda_cohere('Category') %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function varargout = ltpda_cohere(varargin) 0002 % LTPDA_COHERE makes coherence estimates of the time-series objects 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: LTPDA_COHERE makes coherence estimates of the time-series objects 0007 % in the input analysis objects. Coherences are computed using 0008 % MATLAB's mscohere (>> help mscohere). 0009 % 0010 % CALL: b = ltpda_cohere(a1,a2,a3,...,pl) 0011 % 0012 % INPUTS: b - output analysis objects 0013 % aN - input analysis objects (at least two) 0014 % pl - input parameter list 0015 % 0016 % The function makes coherence estimates between all 0017 % input AOs. Therefore, if the input argument list contains N 0018 % analysis objects, the output, b, will contain NXN coherence estimates. 0019 % 0020 % If the last input argument is a parameter list (plist) it is used. 0021 % The following parameters are recognised. 0022 % 0023 % PARAMETERS: Win - a specwin window object [default: Kaiser -200dB psll] 0024 % Olap - segment percent overlap [default: taken from window function] 0025 % Nfft - number of samples in each fft [default: half length of input data] 0026 % Order - order of detrending. 0027 % -1 - no detrending 0028 % 0 - subtract mean [default] 0029 % 1 - subtract linear fit 0030 % N - subtract fit of polynomial, order N 0031 % 0032 % 0033 % VERSION: $Id: ltpda_cohere.html,v 1.14 2008/03/31 10:27:39 hewitson Exp $ 0034 % 0035 % HISTORY: 07-02-2007 M Hewitson 0036 % Creation 0037 % 0038 % The following call returns a parameter list object that contains the 0039 % default parameter values: 0040 % 0041 % >> pl = ltpda_cohere('Params') 0042 % 0043 % The following call returns a string that contains the routine CVS version: 0044 % 0045 % >> version = ltpda_cohere('Version') 0046 % 0047 % The following call returns a string that contains the routine category: 0048 % 0049 % >> category = ltpda_cohere('Category') 0050 % 0051 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0052 0053 ALGONAME = mfilename; 0054 VERSION = '$Id: ltpda_cohere.html,v 1.14 2008/03/31 10:27:39 hewitson Exp $'; 0055 CATEGORY = 'Signal Processing'; 0056 0057 0058 %% Check if this is a call for parameters, the CVS version string 0059 % or the function category 0060 if nargin == 1 && ischar(varargin{1}) 0061 in = char(varargin{1}); 0062 if strcmp(in, 'Params') 0063 varargout{1} = getDefaultPL(); 0064 return 0065 elseif strcmp(in, 'Version') 0066 varargout{1} = VERSION; 0067 return 0068 elseif strcmp(in, 'Category') 0069 varargout{1} = CATEGORY; 0070 return 0071 end 0072 end 0073 0074 % capture input variable names 0075 invars = {}; 0076 as = []; 0077 ps = []; 0078 for j=1:nargin 0079 if isa(varargin{j}, 'ao') 0080 as = [as varargin{j}]; 0081 % record the name of this ao 0082 invars = [invars cellstr(inputname(j))]; 0083 end 0084 if isa(varargin{j}, 'plist') 0085 ps = [ps varargin{j}]; 0086 end 0087 end 0088 0089 0090 % check plist 0091 if isempty(ps) 0092 pl = getDefaultPL(); 0093 else 0094 pl = combine(ps, getDefaultPL); 0095 end 0096 0097 varargout{1} = ltpda_xspec(as, pl, 'COHERE', ALGONAME, VERSION, invars); 0098 0099 0100 %-------------------------------------------------------------------------- 0101 % Get default params 0102 function plo = getDefaultPL() 0103 0104 disp('* creating default plist...'); 0105 0106 plo = plist('Nfft', -0.5, ... 0107 'Win', specwin('Kaiser', 1, 100), ... 0108 'Olap', -1, ... 0109 'Order', 0); 0110 0111 disp('* done.'); 0112 0113 0114 0115