Home > NoiseTools > nt_bias_mask.m

# nt_bias_mask

## PURPOSE

[c0,c1]=bias_hi_amp(x,mask) - covariance of masked signal

## SYNOPSIS

function [c0,c1]=bias_mask(x,mask)

## DESCRIPTION

    [c0,c1]=bias_hi_amp(x,mask) - covariance of masked signal

     c0: covariance of part for which mask<0
     c1: covariance of part for which mask>0

     x: data set (time X channels or time X channels X trials)
     mask: mask function (time X 1 or time X 1 X trials)

## CROSS-REFERENCE INFORMATION

This function calls:

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

This function is called by:

## SOURCE CODE

    0001 function [c0,c1]=bias_mask(x,mask)
    0002 %[c0,c1]=bias_hi_amp(x,mask) - covariance of masked signal
    0003 %
    0004 % c0: covariance of part for which mask<0
    0005 % c1: covariance of part for which mask>0
    0006 %
    0007 % x: data set (time X channels or time X channels X trials)
    0008 % mask: mask function (time X 1 or time X 1 X trials)
    0009
    0010 if nargin<2; error('!'); end
    0011
    0012 x=nt_unfold(x);
    0013 mask=nt_unfold(mask);
    0014
    0015
    0016 c0=nt_cov(nt_vecmult(x(find(mask<=0),:),mask(find(mask<=0))));
    0017 c1=nt_cov(nt_vecmult(x(find(mask>0),:),mask(find(mask>0))));