Home > wafo > cycles > cc2amp.m

# cc2amp

## PURPOSE

Calculates the amplitudes from a cycle count.

[amp]=cc2amp(cc)

## DESCRIPTION

``` CC2AMP Calculates the amplitudes from a cycle count.

CALL:  amp = cc2amp(cc);

amp = a vector with amplitudes.
cc    = a two column matrix with cycles.

The amplitude of a cycle is defined as  (Max-min)/2

Example:
[mM,Mm] = tp2mm(TP);
amp = cc2amp(mM);
whisto(amp);

## CROSS-REFERENCE INFORMATION

This function calls:
 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'

## SOURCE CODE

```001 function [amp]=cc2amp(cc)
002 %CC2AMP Calculates the amplitudes from a cycle count.
003 %
004 % CALL:  amp = cc2amp(cc);
005 %
006 %   amp = a vector with amplitudes.
007 %   cc    = a two column matrix with cycles.
008 %
009 % The amplitude of a cycle is defined as  (Max-min)/2
010 %
011 % Example:
012 %   x=load('sea.dat'); TP = dat2tp(x);
013 %   [mM,Mm] = tp2mm(TP);
014 %   amp = cc2amp(mM);
015 %   whisto(amp);
016 %
018
019 % Tested on Matlab 6.0
020 %
021 % History:
022 % Revised by jr 01-Apr-2001
023 % - histo-> whisto in example
024 % - minor changes help text
025 % Corrected by PJ 09-Dec-1999
026 %   Now calculates amplitudes (before ranges)
027 % Created by PJ (Pär Johannesson) 01-Nov-1999
028
029 % Check input arguments
030
031 ni = nargin;
032 no = nargout;
033 error(nargchk(1,1,ni));
034
035 % Calculate amplitudes
036
037 amp = (cc(:,2)-cc(:,1))/2;
038 %amp = abs(cc(:,2)-cc(:,1));
039```

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