Home > wafo > wsim > private > fr2nt.m

# fr2nt

## PURPOSE

Calculates the counting distribution given the frequency matrix.

NT = fr2nt(f)

## DESCRIPTION

``` FR2NT  Calculates the counting distribution given the frequency matrix.

CALL: NT = fr2nt(fr);

where

NT = a square counting distribution matrix for a cycle count,
fr = a square frequency matrix for a cycle count.```

## CROSS-REFERENCE INFORMATION

This function calls:
 triu Extract upper triangular part.
This function is called by:
 fr2comb Combination matrix for placing out cycles given the frequency matrix

## SOURCE CODE

```01 function NT = fr2nt(f)
02 %FR2NT  Calculates the counting distribution given the frequency matrix.
03 %
04 %  CALL: NT = fr2nt(fr);
05 %
06 %  where
07 %
08 %        NT = a square counting distribution matrix for a cycle count,
09 %        fr = a square frequency matrix for a cycle count.
10
11 %  Copyright 1993, Mats Frendahl, Dept. of Math. Stat., University of Lund.
12
13 [n m]=size(f);
14 if (n==m) & (n>2)
15    m1=cumsum(cumsum(f')'-f);
16    m2=zeros(n,n);
17    m2(2:n-1,2:n-1)=m1(1:n-2,2:n-1);
18    NT=fliplr(triu(fliplr(m2),0));
19 else
20    disp(['   The matrix is not square or dimension < 3.'])
21    disp(['   Program will terminate.'])
22 end
23```

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