Home > wafo > cycles > cc2cmat.m

cc2cmat

PURPOSE ^

Calculates the cycle count matrix from a cycle count.

SYNOPSIS ^

[F,h] = cc2cmat(param,cc,ddef,method,h,NOsubzero,alpha)

DESCRIPTION ^

  CC2CMAT Calculates the cycle count matrix from a cycle count.
  using (0) Histogram, (1) Kernel smoothing, (2) Kernel smoothing.
 
  CALL:  [F,h] = cc2cmat(param,cc,ddef,method,h,NOsubzero,alpha);
 
  Input:
    param     = Parameter vector, [a b n], defines the grid.
    cc        = Cycle count with minima in column 1 and maxima in column 2. [nx2]
    ddef      =  1: causes peaks to be projected upwards and troughs 
                    downwards to the closest discrete level (default).
              =  0: causes peaks and troughs to be projected
                    the closest discrete level.
              = -1: causes peaks to be projected downwards and the 
                    troughs upwards to the closest discrete level.
    method    =  0: Histogram. (Default)
                 1: Kernel estimator (constant bandwidth). 
                 2: Adaptiv kernel estimator (local bandwidth). 
    h         = Bandwidth (Optional, Default='automatic choice')
    NOsubzero = Number of subdiagonals that are set to zero
                (Optional, Default = 0, only the diagonal is zero)
    alpha     = Parameter for method (2) (Optional, Default=0.5).
                A number between 0 and 1.
                alpha=0 implies constant bandwidth (method 1).
                alpha=1 implies most varying bandwidth.
 
  Output:
    F       = Estimated cycle matrix.
    h       = Selected bandwidth.
 
  See also  dcc2cmat, cc2dcc, smoothcmat

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function [F,h] = cc2cmat(param,cc,ddef,method,h,NOsubzero,alpha)
002 % CC2CMAT Calculates the cycle count matrix from a cycle count.
003 % using (0) Histogram, (1) Kernel smoothing, (2) Kernel smoothing.
004 %
005 % CALL:  [F,h] = cc2cmat(param,cc,ddef,method,h,NOsubzero,alpha);
006 %
007 % Input:
008 %   param     = Parameter vector, [a b n], defines the grid.
009 %   cc        = Cycle count with minima in column 1 and maxima in column 2. [nx2]
010 %   ddef      =  1: causes peaks to be projected upwards and troughs 
011 %                   downwards to the closest discrete level (default).
012 %             =  0: causes peaks and troughs to be projected
013 %                   the closest discrete level.
014 %             = -1: causes peaks to be projected downwards and the 
015 %                   troughs upwards to the closest discrete level.
016 %   method    =  0: Histogram. (Default)
017 %                1: Kernel estimator (constant bandwidth). 
018 %                2: Adaptiv kernel estimator (local bandwidth). 
019 %   h         = Bandwidth (Optional, Default='automatic choice')
020 %   NOsubzero = Number of subdiagonals that are set to zero
021 %               (Optional, Default = 0, only the diagonal is zero)
022 %   alpha     = Parameter for method (2) (Optional, Default=0.5).
023 %               A number between 0 and 1.
024 %               alpha=0 implies constant bandwidth (method 1).
025 %               alpha=1 implies most varying bandwidth.
026 %
027 % Output:
028 %   F       = Estimated cycle matrix.
029 %   h       = Selected bandwidth.
030 %
031 % See also  dcc2cmat, cc2dcc, smoothcmat
032 
033 % Tested  on Matlab 5.3
034 %
035 % History:
036 % Correction by PJ 14-Feb-2000
037 %   Changed 'smthcmat' to 'smoothcmat'
038 % Revised by PJ  01-Nov-1999
039 %   updated for WAFO
040 % Created by PJ (Pär Johannesson) 1997
041 %   from 'Toolbox: Rainflow Cycles for Switching Processes V.1.0'
042 
043 % Check input arguments
044 
045 ni = nargin;
046 no = nargout;
047 error(nargchk(2,7,ni));
048 
049 if ni<3, ddef=[]; end
050 if ni<4, method=0; end
051 if ni<5, h=[]; end
052 if ni<6, NOsubzero=[]; end
053 if ni<7, alpha=[]; end
054 
055 if method < 0 | method >2
056   error('Input argument "method" should be 0, 1 or 2');
057 end
058 
059 u = levels(param); % Discretization levels
060 
061 n = param(3);     % Size of matrix
062 N = length(cc);   % Total number of cycles
063 
064 % Compute Histogram
065 
066 dcc = cc2dcc(param,cc,ddef);
067 F = dcc2cmat(dcc,n);
068 
069 % Smooth by using Kernel estimator ?
070 
071 if method >= 1   
072   [F,h] = smoothcmat(F,method,h,NOsubzero,alpha);
073 end
074

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group


Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003