Home > NoiseTools > nt_bias_hi_amp.m

# nt_bias_hi_amp

## PURPOSE

[c0,c1]=bias_hi_amp(x,exponent) - covariance with and without hi-amp bias

## SYNOPSIS

function [c0,c1,w]=bias_hi_amp(x,exponent)

## DESCRIPTION

    [c0,c1]=bias_hi_amp(x,exponent) - covariance with and without hi-amp bias

     y: high-amplitude component

     x: data set (2D or 3D)
     exponent: exponent to apply to squared difference (larger=peakier) [default: 0.5]

## CROSS-REFERENCE INFORMATION

This function calls:

- nt_cov [c,tw]=nt_cov(x,shifts,w) - time shift covariance
- nt_fold y=fold(x,epochsize) - fold 2D to 3D
- nt_vecadd y=nt_vecadd(x,v) - add vector to all rows or columns of matrix
- nt_vecmult y=nt_vecmult(x,v) - multiply all rows or columns of matrix by vector

This function is called by:

- nt_hi_amp y=nt_hi_amp(x) - decompose into high-amplitude components

## SOURCE CODE

    0001 function [c0,c1,w]=bias_hi_amp(x,exponent)
    0002 %[c0,c1]=bias_hi_amp(x,exponent) - covariance with and without hi-amp bias
    0003 %
    0004 % y: high-amplitude component
    0005 %
    0006 % x: data set (2D or 3D)
    0007 % exponent: exponent to apply to squared difference (larger=peakier) [default: 0.5]
    0008
    0009 if nargin<2; exponent=0.5; end
    0010
    0011 % bias function emphasizes high-amplitude
    0012 w=mean((x.^2).^exponent,2);
    0013 ww=squeeze(min(w,[],1));
    0014 w=nt_vecadd(squeeze(w),-ww');  % subtract minimum from each trial (sharpens the bias function)
    0015 w=nt_fold(w(:),size(x,1));
    0016
    0017 c0=nt_cov(x);
    0018 % c1=tscov(vecmult(unfold(x),w));
    0019 % save memory:
    0020 c1=zeros(size(x,2));
    0021 for k=1:size(x,3)
    0022     c1=c1+nt_cov(nt_vecmult(x(:,:,k),w(:,:,k)));
    0023 end