Home > wafo > wsim > private > fr2comb.m

# fr2comb

## PURPOSE

Combination matrix for placing out cycles given the frequency matrix

## SYNOPSIS

comb=fr2comb(f,r)

## DESCRIPTION

` FR2COMB Combination matrix for placing out cycles given the frequency matrix`

## CROSS-REFERENCE INFORMATION

This function calls:
 fr2nt Calculates the counting distribution given the frequency matrix. triu Extract upper triangular part.
This function is called by:
 fr2res Generates a stationary residual from the frequency matrix. rfc2load_fat Recontructs a load process given the frequency matrix (and residual).

## SOURCE CODE

```001 function comb=fr2comb(f,r)
002 %FR2COMB Combination matrix for placing out cycles given the frequency matrix
003
004 %  Given the frequency matrix of a cycle count the function
005 %  calculates the combination matrix for placing out cycles
006
007 %  Copyright 1993, Mats Frendahl & Igor Rychlik,
008 %  Dept. of Math. Stat., University of Lund.
009
010 nres=length(r);
011
012 N=length(f); nt=fr2nt(f); comb=zeros(N,N);
013
014 for i=1:N
015   for j=1:N-i+1
016     comb(i,j)=2*nt(i,j)+sum(f(1:i-1,j))+sum(f(i,1:j-1));
017   end
018 end
019
020 for k=1:length(r)-1
021   i=r(k); j=r(k+1);
022   if ~isempty(j+1:i) %i>j+1
023     M=j+1:i; m=N+1-M;
024     comb(M,m)=comb(M,m)+1;
025   elseif ~isempty(i:j-1) %i<j-1
026     M=i:j-1; m=N+1-M;
027     comb(M,m)=comb(M,m)+1;
028   end
029 end
030
031 comb=fliplr(triu(fliplr(comb),1));
032```

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