Home > wafo > cycles > cmat2lc.m

# cmat2lc

## PURPOSE

Calculates the level crossings from a cycle matrix.

## SYNOPSIS

lc = cmat2lc(param,F)

## DESCRIPTION

``` CMAT2LC Calculates the level crossings from a cycle matrix.

CALL:  lc = cmat2lc(param,F);

Input:
param = Parameter vector, [a b n], defines the discretization.
F     = Cycle matrix (e.g. rainflow matrix) [nxn]
Output:
lc    = a two column matrix with levels and number of upcrossings.

Example:
param = [-2 2 151]; F = cc2cmat(param,RFC);
lc = cmat2lc(param,F);
plot(lc(:,1),lc(:,2))

## CROSS-REFERENCE INFORMATION

This function calls:
 cmat2nt Calculates a counting distribution from a cycle matrix. levels Calculates discrete levels given the parameter matrix. error Display message and abort function.
This function is called by:
 Chapter4 % CHAPTER4 contains the commands used in Chapter 4 of the tutorial cmat2extralc Extrapolate level crossing spectrum itmkurs_lab2 Script to computer exercises 2 rfmextrapolate Extrapolates a rainflow matrix. test_cycles Quick test of the routines in module 'cycles'

## SOURCE CODE

```001 function lc = cmat2lc(param,F)
002 %CMAT2LC Calculates the level crossings from a cycle matrix.
003 %
004 % CALL:  lc = cmat2lc(param,F);
005 %
006 % Input:
007 %   param = Parameter vector, [a b n], defines the discretization.
008 %   F     = Cycle matrix (e.g. rainflow matrix) [nxn]
009 % Output:
010 %   lc    = a two column matrix with levels and number of upcrossings.
011 %
012 % Example:
013 %  x = load('sea.dat'); TP=dat2tp(x); RFC=tp2rfc(TP);
014 %  param = [-2 2 151]; F = cc2cmat(param,RFC);
015 %  lc = cmat2lc(param,F);
016 %  plot(lc(:,1),lc(:,2))
017 %
019
020 % Tested on Matlab 6.0
021 %
022 % History:
023 % Revised by jr 01-Apr-2001
025 % - Updated help
026 % Created by PJ (Pär Johannesson) 14-Jan-2000
027
028 % Check input arguments
029 ni = nargin;
030 no = nargout;
031 error(nargchk(2,2,ni));
032
033 lc = [levels(param)' diag(cmat2nt(F))];
034```

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