


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).
Usage: b = ltpda_cpsd(a1,a2,a3,...,pl)
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)
The following call returns a parameter list object that contains the
default parameter values:
>> pl = ltpda_cpsd('Params')
M Hewitson 07-02-07


0001 function varargout = ltpda_cpsd(varargin) 0002 0003 % LTPDA_CPSD makes cross-spectral density estimates of the time-series 0004 % objects in the input analysis objects. CPSDs are computed 0005 % using MATLAB's cpsd (>> help cpsd). 0006 % 0007 % 0008 % Usage: b = ltpda_cpsd(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 CPSD estimates between a1 and all other input AOs. 0015 % Therefore, if the input argument list contains N analysis objects, the 0016 % output a will contain N-1 CPSD 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 % 'Debug' - debug level for terminal output (0-1) 0026 % 0027 % The following call returns a parameter list object that contains the 0028 % default parameter values: 0029 % 0030 % >> pl = ltpda_cpsd('Params') 0031 % 0032 % 0033 % M Hewitson 07-02-07 0034 % 0035 0036 ALGONAME = mfilename; 0037 VERSION = '$Id: ltpda_cpsd.html,v 1.2 2007/07/10 05:37:14 hewitson Exp $'; 0038 0039 0040 % Check if this is a call for parameters 0041 if nargin == 1 0042 in = char(varargin{1}); 0043 if strcmp(in, 'Params') 0044 varargout{1} = getDefaultPL(); 0045 return 0046 end 0047 end 0048 0049 % capture input variable names 0050 invars = {}; 0051 as = []; 0052 ps = []; 0053 for j=1:nargin 0054 invars = [invars cellstr(inputname(j))]; 0055 if isa(varargin{j}, 'ao') 0056 as = [as varargin{j}]; 0057 end 0058 if isa(varargin{j}, 'plist') 0059 ps = [ps varargin{j}]; 0060 end 0061 end 0062 0063 0064 % check plist 0065 if isempty(ps) 0066 pl = getDefaultPL(); 0067 else 0068 pl = combine(ps, getDefaultPL); 0069 end 0070 0071 varargout{1} = ltpda_xspec(as, pl, 'CPSD', ALGONAME, VERSION, invars); 0072 0073 0074 %-------------------------------------------------------------------------- 0075 % Get default params 0076 function plo = getDefaultPL() 0077 0078 disp('* creating default plist...'); 0079 plo = plist(); 0080 plo = append(plo, param('Nfft', -0.5)); 0081 plo = append(plo, param('Win', specwin('Kaiser', 1, 100))); 0082 plo = append(plo, param('Nolap', -1)); 0083 disp('* done.'); 0084 0085