www.pudn.com > cyclostationary_toolbox.rar > cyclic_correlation_coefficient.m, change:1997-11-25,size:1047b


function rho=cyclic_correlation_coefficient(S,tol)
%
% CYCLIC_CORRELATION_COEFFICIENT
%              
%              calculates the cyclic correlation coefficient for signal
%              from its spectral correlation density
%             
% USAGE
%              rho=cyclic_correlation_coefficient(S,tol)
%
%              Optional parameter tol can be used to set all
%              rho(x,y) to zero if S(x,y) is less than tol% of max(S)

% File: cyclic_correlation_coefficient.m
% Last Revised: 25/11/97
% Created: 25/11/97
% Author: Andrew C. McCormick
% (C) University of Strathclyde

[rows,cols]=size(S);

rho=zeros(rows,cols);

S=abs(S);

mxs=max(max(S));

scale_factor=2*cols/rows;

for f=1:rows
  for a=1:cols
    fplus=f+floor(a/scale_factor);
    fminus=f-floor(a/scale_factor);
    if fplus>rows
      fplus=fplus-rows;
    end
    if fminus<1
      fminus=fminus+rows;
    end
    rho(f,a)=S(f,a)/sqrt(S(fplus,1)*S(fminus,1));
  end
end

if nargin==2
  [i,j]=find(S<tol*mxs/100);

  for k=1:length(i)
    rho(i(k),j(k))=0;
  end
end