COHERE makes coherence estimates of the time-series objects %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: COHERE makes coherence estimates of the time-series objects in the input analysis objects. Coherences are computed using code based on MATLAB's mscohere (>> help mscohere). CALL: b = 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 M-FILE INFO: Get information about this methods by calling >> ao.getInfo('cohere') Get information about a specified set-plist by calling: >> ao.getInfo('cohere', 'None') VERSION: $Id: cohere.m,v 1.10 2008/09/05 11:05:28 ingo Exp $ HISTORY: 07-02-2007 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % COHERE makes coherence estimates of the time-series objects 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: COHERE makes coherence estimates of the time-series objects 0005 % in the input analysis objects. Coherences are computed using 0006 % code based on MATLAB's mscohere (>> help mscohere). 0007 % 0008 % CALL: b = cohere(a1,a2,a3,...,pl) 0009 % 0010 % INPUTS: 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 all 0015 % input AOs. Therefore, if the input argument list contains N 0016 % analysis objects, the output, b, will contain NXN coherence estimates. 0017 % 0018 % If the last input argument is a parameter list (plist) it is used. 0019 % The following parameters are recognised. 0020 % 0021 % PARAMETERS: Win - a specwin window object [default: Kaiser -200dB psll] 0022 % Olap - segment percent overlap [default: taken from window function] 0023 % Nfft - number of samples in each fft [default: half length of input data] 0024 % Order - order of detrending. 0025 % -1 - no detrending 0026 % 0 - subtract mean [default] 0027 % 1 - subtract linear fit 0028 % N - subtract fit of polynomial, order N 0029 % 0030 % M-FILE INFO: Get information about this methods by calling 0031 % >> ao.getInfo('cohere') 0032 % 0033 % Get information about a specified set-plist by calling: 0034 % >> ao.getInfo('cohere', 'None') 0035 % 0036 % VERSION: $Id: cohere.m,v 1.10 2008/09/05 11:05:28 ingo Exp $ 0037 % 0038 % HISTORY: 07-02-2007 M Hewitson 0039 % Creation 0040 % 0041 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0042 0043 function varargout = cohere(varargin) 0044 0045 %% Check if this is a call for parameters 0046 if utils.helper.isinfocall(varargin{:}) 0047 varargout{1} = getInfo(varargin{3}); 0048 return 0049 end 0050 0051 import utils.const.* 0052 utils.helper.msg(msg.MNAME, 'running %s/%s', mfilename('class'), mfilename); 0053 0054 % Collect input variable names 0055 in_names = cell(size(varargin)); 0056 for ii = 1:nargin,in_names{ii} = inputname(ii);end 0057 0058 % Collect all AOs and plists 0059 [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names); 0060 pl = utils.helper.collect_objects(varargin(:), 'plist', in_names); 0061 0062 % combine plists 0063 pl = combine(pl, getDefaultPlist()); 0064 0065 if nargout == 0 0066 error('### cohere cannot be used as a modifier. Please give an output variable.'); 0067 end 0068 0069 varargout{1} = ao.xspec(as, pl, 'mscohere', getInfo, ao_invars); 0070 end 0071 0072 %-------------------------------------------------------------------------- 0073 % Get Info Object 0074 %-------------------------------------------------------------------------- 0075 function ii = getInfo(varargin) 0076 if nargin == 1 && strcmpi(varargin{1}, 'None') 0077 sets = {}; 0078 pl = []; 0079 else 0080 sets = {'Default'}; 0081 pl = getDefaultPlist; 0082 end 0083 % Build info object 0084 ii = minfo(mfilename, 'ao', '', utils.const.categories.sigproc, '$Id: cohere.m,v 1.10 2008/09/05 11:05:28 ingo Exp $', sets, pl); 0085 end 0086 0087 %-------------------------------------------------------------------------- 0088 % Get Default Plist 0089 %-------------------------------------------------------------------------- 0090 function pl = getDefaultPlist() 0091 pl = plist(... 0092 'Nfft', -1, ... 0093 'Win', getappdata(0, 'ltpda_default_spectral_window'), ... 0094 'Olap', -1, ... 0095 'Order', 0); 0096 end 0097 % END 0098