Home > functions > device > filter_func > vb_online_filter_loop.m

vb_online_filter_loop

PURPOSE ^

Online filter calculation

SYNOPSIS ^

function [Y, Z] = vb_online_filter_loop(A, B, C, D, X, Z)

DESCRIPTION ^

 Online filter calculation
 [Y, Z] = vb_online_filter_loop(A, B, C, D, X, Z)
   [A, B, C, D] : filter matrix
    A: D x D, 
    B: 1 x D, 
    C: D x 1, 
    D: 1 x 1
 X : Input signal (Nch x T)
 Z : Internal state variable (Nch x D)
 Y : Output signal  (Nch x T)

    [A, B, C, D] = butter(Norder, freq/(fsamp/2));
    A = A'; B = B'; C = C'; D = D';
   D = Norder or 2*Norder
    A: D x D, 
    B: 1 x D, 
    C: D x 1, 
    D: 1 x 1

    Y = Z * C + X * D; % Output update
    Z = Z * A + X * B; % Internal state variable update

 Masa-aki Sato

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    [Y, Z] = vb_online_filter_loop(A, B, C, D, X, Z)
0002 % Online filter calculation
0003 % [Y, Z] = vb_online_filter_loop(A, B, C, D, X, Z)
0004 %   [A, B, C, D] : filter matrix
0005 %    A: D x D,
0006 %    B: 1 x D,
0007 %    C: D x 1,
0008 %    D: 1 x 1
0009 % X : Input signal (Nch x T)
0010 % Z : Internal state variable (Nch x D)
0011 % Y : Output signal  (Nch x T)
0012 %
0013 %    [A, B, C, D] = butter(Norder, freq/(fsamp/2));
0014 %    A = A'; B = B'; C = C'; D = D';
0015 %   D = Norder or 2*Norder
0016 %    A: D x D,
0017 %    B: 1 x D,
0018 %    C: D x 1,
0019 %    D: 1 x 1
0020 %
0021 %    Y = Z * C + X * D; % Output update
0022 %    Z = Z * A + X * B; % Internal state variable update
0023 %
0024 % Masa-aki Sato
0025 %
0026 % Copyright (C) 2011, ATR All Rights Reserved.
0027 % License : New BSD License(see VBMEG_LICENSE.txt)
0028 
0029 [Nch, T] = size(X);
0030 
0031 Y = zeros(Nch, T);
0032 
0033 for t=1:T
0034     Y(:,t) = Z * C + X(:,t) * D;
0035     Z      = Z * A + X(:,t) * B;
0036 end

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005