Home > NoiseTools > nt_bias_filter.m

# nt_bias_filter

## PURPOSE

[c0,c1]=nt_bias_filter(x,B,A) - covariance with and w/o filter bias

## SYNOPSIS

function [c0,c1]=nt_bias_filter(x,B,A)

## DESCRIPTION

    [c0,c1]=nt_bias_filter(x,B,A) - covariance with and w/o filter bias

     x: data
     B,A: filter coefficients

     NoiseTools
     see nt_filter_peak for a second-order resonator

## CROSS-REFERENCE INFORMATION

This function calls:

- nt_cov [c,tw]=nt_cov(x,shifts,w) - time shift covariance

This function is called by:

- nt_narrowband_scan A=nt_narrowband_scan(x,freqs,sr,Q,plotflag) - scan for narrowband components using DSS

## SUBFUNCTIONS

- function [B,A] = secondorderPeak(Wo,BW)

## SOURCE CODE

    0001 function [c0,c1]=nt_bias_filter(x,B,A)
    0002 %[c0,c1]=nt_bias_filter(x,B,A) - covariance with and w/o filter bias
    0003 %
    0004 % x: data
    0005 % B,A: filter coefficients
    0006 %
    0007 % NoiseTools
    0008 % see nt_filter_peak for a second-order resonator
    0009
    0010 if nargin<3;
    0011     error('!');
    0012 end
    0013
    0014 c0=nt_cov(x);
    0015 x=filter(B,A,x);
    0016 c1=nt_cov(x);
    0017 return
    0018
    0019
    0020
    0021 % example:
    0022 w=0.3;  % center frequency
    0023 Q=10;
    0024 bw=f/Q;
    0025 [B,A]=secondorderPeak(w,bw);
    0026
    0027
    0028
    0029 function [B,A] = secondorderPeak(Wo,BW)
    0030 %second order resonator
    0031
    0032 % Inputs are normalized by pi.
    0033 BW = BW*pi;
    0034 Wo = Wo*pi;
    0035
    0036 Ab=(10*log10(2));
    0037
    0038 Gb   = 10^(-Ab/20);
    0039 beta = (Gb/sqrt(1-Gb.^2))*tan(BW/2);
    0040 gain = 1/(1+beta);
    0041
    0042 B  = (1-gain)*[1 0 -1];
    0043 A  = [1 -2*gain*cos(Wo) (2*gain-1)];