Home > classes > @ao > cpsd.m

cpsd

PURPOSE ^

CPSD makes cross-spectral density estimates of the time-series objects.

SYNOPSIS ^

function varargout = cpsd(varargin)

DESCRIPTION ^

 CPSD makes cross-spectral density estimates of the time-series objects.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: CPSD makes cross-spectral density estimates of the
              time-series objects in the input analysis objects. CPSDs are computed
              using a modified version of MATLAB's cpsd (>> help cpsd).

 CALL:        b = 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 all input AOs.
              Therefore, if the input argument list contains N analysis objects, the
              output a will contain NxN CPSD estimates.
              The diagonal elements will be S_ai_ai and will be equivalent to
              the output of ltpda_pwelch(ai)

              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: length of input data]
             'Order' - order of segment 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('cpsd')

              Get information about a specified set-plist by calling:
              >> ao.getInfo('cpsd', 'None')

 VERSION:     $Id: cpsd.m,v 1.9 2008/09/05 11:05:28 ingo Exp $

 HISTORY:     07-02-2007 M Hewitson
                 Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 % CPSD makes cross-spectral density estimates of the time-series objects.
0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0003 %
0004 % DESCRIPTION: CPSD makes cross-spectral density estimates of the
0005 %              time-series objects in the input analysis objects. CPSDs are computed
0006 %              using a modified version of MATLAB's cpsd (>> help cpsd).
0007 %
0008 % CALL:        b = cpsd(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 CPSD estimates between all input AOs.
0015 %              Therefore, if the input argument list contains N analysis objects, the
0016 %              output a will contain NxN CPSD estimates.
0017 %              The diagonal elements will be S_ai_ai and will be equivalent to
0018 %              the output of ltpda_pwelch(ai)
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 %             'Olap'  - segment percent overlap [default: taken from window function]
0025 %             'Nfft'  - number of samples in each fft [default: length of input data]
0026 %             'Order' - order of segment 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 % M-FILE INFO: Get information about this methods by calling
0033 %              >> ao.getInfo('cpsd')
0034 %
0035 %              Get information about a specified set-plist by calling:
0036 %              >> ao.getInfo('cpsd', 'None')
0037 %
0038 % VERSION:     $Id: cpsd.m,v 1.9 2008/09/05 11:05:28 ingo Exp $
0039 %
0040 % HISTORY:     07-02-2007 M Hewitson
0041 %                 Creation
0042 %
0043 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0044 
0045 function varargout = cpsd(varargin)
0046 
0047   % Check if this is a call for parameters
0048   if utils.helper.isinfocall(varargin{:})
0049     varargout{1} = getInfo(varargin{3});
0050     return
0051   end
0052 
0053   import utils.const.*
0054   utils.helper.msg(msg.MNAME, 'running %s/%s', mfilename('class'), mfilename);
0055   
0056   % Collect input variable names
0057   in_names = cell(size(varargin));
0058   for ii = 1:nargin,in_names{ii} = inputname(ii);end
0059 
0060   % Collect all AOs and plists
0061   [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names);
0062   pl              = utils.helper.collect_objects(varargin(:), 'plist', in_names);
0063 
0064   if nargout == 0
0065     error('### cohere cannot be used as a modifier. Please give an output variable.');
0066   end
0067   
0068   % combine plists
0069   pl = combine(pl, getDefaultPlist());
0070 
0071   varargout{1} = ao.xspec(as, pl, 'cpsd', getInfo, ao_invars);
0072 end
0073 
0074 %--------------------------------------------------------------------------
0075 % Get Info Object
0076 %--------------------------------------------------------------------------
0077 function ii = getInfo(varargin)
0078   if nargin == 1 && strcmpi(varargin{1}, 'None')
0079     sets = {};
0080     pl   = [];
0081   else
0082     sets = {'Default'};
0083     pl   = getDefaultPlist;
0084   end
0085   % Build info object
0086   ii = minfo(mfilename, 'ao', '', utils.const.categories.sigproc, '$Id: cpsd.m,v 1.9 2008/09/05 11:05:28 ingo Exp $', sets, pl);
0087 end
0088 
0089 %--------------------------------------------------------------------------
0090 % Get Default Plist
0091 %--------------------------------------------------------------------------
0092 function pl = getDefaultPlist()
0093   pl = plist(...
0094     'Nfft', -1, ...
0095     'Win', getappdata(0, 'ltpda_default_spectral_window'), ...
0096     'Olap', -1, ...
0097     'Order', 0);
0098 end
0099

Generated on Mon 08-Sep-2008 13:18:47 by m2html © 2003