Home > wafo > cycles > tp2lc.m

# tp2lc

## PURPOSE Calculates the number of upcrossings from the turning points.

## SYNOPSIS lc=tp2lc(tp,def,plotflag,sa)

## DESCRIPTION ``` TP2LC  Calculates the number of upcrossings from the turning points.

CALL: lc = tp2lc(TP,def,plotflag,sa);

lc = a two column matrix with levels and number of upcrossings. [mx2]
TP = the turning points.                       [nx2]

def = 1, only upcrossings.
2, upcrossings and maxima (default).
3, upcrossings, minima, and maxima.
4, upcrossings and minima.

plotflag = 0, no plotting
1, plot the number of upcrossings overplotted
with Rice formula for the crossing intensity
for a Gaussian process (default).

sa  = standard deviation of the process
(Default estimates it from the number of upcrossings)

See also  lcplot```

## CROSS-REFERENCE INFORMATION This function calls:
 cc2lc Calculates the number of upcrossings from a cycle count tp2mm Calculates min2Max and Max2min cycles from a sequence of turning points error Display message and abort function.
This function is called by:
 Chapter4 % CHAPTER4 contains the commands used in Chapter 4 of the tutorial itmkurs_lab1 Script to computer exercises 1 test_cycles Quick test of the routines in module 'cycles' tpextrapolate Extrapolates a sequence of turning points.

## SOURCE CODE ```001 function lc=tp2lc(tp,def,plotflag,sa)
002 %TP2LC  Calculates the number of upcrossings from the turning points.
003 %
004 % CALL: lc = tp2lc(TP,def,plotflag,sa);
005 %
006 %      lc = a two column matrix with levels and number of upcrossings. [mx2]
007 %      TP = the turning points.                       [nx2]
008 %
009 %     def = 1, only upcrossings.
010 %           2, upcrossings and maxima (default).
011 %           3, upcrossings, minima, and maxima.
012 %           4, upcrossings and minima.
013 %
014 %plotflag = 0, no plotting
015 %           1, plot the number of upcrossings overplotted
016 %              with Rice formula for the crossing intensity
017 %              for a Gaussian process (default).
018 %
019 %
020 %     sa  = standard deviation of the process
021 %           (Default estimates it from the number of upcrossings)
022 %
023 % See also  lcplot
024
025 % Tested  on Matlab  5.3
026 %
027 % History:
028 % Created by PJ (Pär Johannesson) 09-Jan-2000
029
030 % Check input arguments
031
032 ni = nargin;
033 no = nargout;
034 error(nargchk(1,4,ni));
035
036 if ni<2, def=[]; end
037 if ni<3, plotflag=[]; end
038 if ni<4, sa=[]; end
039
040 % Get min-max cycles
041 mM = tp2mm(tp);
042 % Get level crossings
043 %lc = cc2lc(mM,def,plotflag,sa);
044 lc = cc2lc(mM,def,0,sa);
045```

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