Home > NoiseTools > nt_non_rep_power.m

# nt_non_rep_power

## PURPOSE

[r,pwr0,pwr1]=nt_non_rep_power(x,nIterations,nComps) - find non repeating components

## SYNOPSIS

function [r,pwr0,pwr1]=nt_non_rep_power(x,nIterations)

## DESCRIPTION

    [r,pwr0,pwr1]=nt_non_rep_power(x,nIterations,nComps) - find non repeating components

      r: component matrix (time*comp*trial)
      pwr0, pwr1: from DSS

      x: data (time*comp*trial)
      nIterations: number of times to iterate DSS [default: 2]
      nComps: number of components to return [default: all]

## CROSS-REFERENCE INFORMATION

This function calls:

- nt_cov [c,tw]=nt_cov(x,shifts,w) - time shift covariance
- nt_dss0 [todss,pwr1,pwr2]=nt_dss0(c0,c1,keep1,keep2) - dss from covariance
- nt_mmat y=nt_mmat(x,m) - matrix multiplication (with convolution)
- nt_normpage y=nt_normpage(x,w) - normalize each page so its weighted msq is 1

This function is called by:

## SOURCE CODE

    0001 function [r,pwr0,pwr1]=nt_non_rep_power(x,nIterations)
    0002 %[r,pwr0,pwr1]=nt_non_rep_power(x,nIterations,nComps) - find non repeating components
    0003 %
    0004 %  r: component matrix (time*comp*trial)
    0005 %  pwr0, pwr1: from DSS
    0006 %
    0007 %  x: data (time*comp*trial)
    0008 %  nIterations: number of times to iterate DSS [default: 2]
    0009 %  nComps: number of components to return [default: all]
    0010 %
    0011
    0012 if nargin<3||isempty(nComps); nComps=inf; end
    0013 if nargin<2||isempty(nIterations); nIterations=2; end
    0014
    0015 if ~iscell(x) ; x={x}; end
    0016
    0017
    0018
    0019 for k=1:nIterations
    0020     [m,n,o]=size(x{1});
    0021     c0=zeros(n);
    0022     c1=zeros(n);
    0023     for k=1:numel(x)
    0024         x{k}=x{k}/sqrt(mean(x{k}(:).^2)); % divide by total power over this condition
    0025         c0=c0+nt_cov(nt_normpage(x{k}));
    0026         c1=c1+nt_cov(x{k});
    0027     end
    0028     [todss,pwr0,pwr1]=nt_dss0(c0,c1);
    0029     for k=1:numel(x)
    0030         x{k}=nt_mmat(x{k},todss);
    0031     end
    0032 end
    0033
    0034 r=x;