LTPDA_CPSD makes cross-spectral density estimates of the time-series objects. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: LTPDA_CPSD makes cross-spectral density estimates of the time-series objects in the input analysis objects. CPSDs are computed using MATLAB's cpsd (>> help cpsd). CALL: b = ltpda_cpsd(a1,a2,a3,...,pl) INPUTS: b - output analysis objects aN - input analysis objects (at least two) pl - input parameter list The function makes CPSD estimates between a1 and all other input AOs. Therefore, if the input argument list contains N analysis objects, the output a will contain N-1 CPSD 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] 'Debug' - debug level for terminal output (0-1) VERSION: $Id: ltpda_cpsd.m,v 1.7 2007/07/16 12:52:21 ingo Exp $ HISTORY: 07-02-2007 M Hewitson Creation The following call returns a parameter list object that contains the default parameter values: >> pl = ltpda_cpsd('Params') %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function varargout = ltpda_cpsd(varargin) 0002 % LTPDA_CPSD makes cross-spectral density estimates of the time-series objects. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: LTPDA_CPSD makes cross-spectral density estimates of the 0007 % time-series objects in the input analysis objects. CPSDs are computed 0008 % using MATLAB's cpsd (>> help cpsd). 0009 % 0010 % CALL: b = ltpda_cpsd(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 CPSD estimates between a1 and all other input AOs. 0017 % Therefore, if the input argument list contains N analysis objects, the 0018 % output a will contain N-1 CPSD estimates. 0019 % 0020 % If the last input argument is a parameter list (plist) it is used. The 0021 % following parameters are recognised. 0022 % 0023 % PARAMETERS: 'Win' - a specwin window object [default: Kaiser -200dB psll] 0024 % 'Nolap' - segment overlap (number of samples) [default: taken from window function] 0025 % 'Nfft' - number of samples in each fft [default: fs of input data] 0026 % 'Debug' - debug level for terminal output (0-1) 0027 % 0028 % VERSION: $Id: ltpda_cpsd.m,v 1.7 2007/07/16 12:52:21 ingo Exp $ 0029 % 0030 % HISTORY: 07-02-2007 M Hewitson 0031 % Creation 0032 % 0033 % The following call returns a parameter list object that contains the 0034 % default parameter values: 0035 % 0036 % >> pl = ltpda_cpsd('Params') 0037 % 0038 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0039 0040 ALGONAME = mfilename; 0041 VERSION = '$Id: ltpda_cpsd.m,v 1.7 2007/07/16 12:52:21 ingo Exp $'; 0042 0043 0044 % Check if this is a call for parameters 0045 if nargin == 1 0046 in = char(varargin{1}); 0047 if strcmp(in, 'Params') 0048 varargout{1} = getDefaultPL(); 0049 return 0050 end 0051 end 0052 0053 % capture input variable names 0054 invars = {}; 0055 as = []; 0056 ps = []; 0057 for j=1:nargin 0058 invars = [invars cellstr(inputname(j))]; 0059 if isa(varargin{j}, 'ao') 0060 as = [as varargin{j}]; 0061 end 0062 if isa(varargin{j}, 'plist') 0063 ps = [ps varargin{j}]; 0064 end 0065 end 0066 0067 0068 % check plist 0069 if isempty(ps) 0070 pl = getDefaultPL(); 0071 else 0072 pl = combine(ps, getDefaultPL); 0073 end 0074 0075 varargout{1} = ltpda_xspec(as, pl, 'CPSD', ALGONAME, VERSION, invars); 0076 0077 0078 %-------------------------------------------------------------------------- 0079 % Get default params 0080 function plo = getDefaultPL() 0081 0082 disp('* creating default plist...'); 0083 plo = plist(); 0084 plo = append(plo, param('Nfft', -0.5)); 0085 plo = append(plo, param('Win', specwin('Kaiser', 1, 100))); 0086 plo = append(plo, param('Nolap', -1)); 0087 disp('* done.'); 0088 0089