view m-toolbox/classes/@miir/mklowpass.m @ 1:2014ba5b353a database-connection-manager

Remove old code
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Sat, 03 Dec 2011 18:13:55 +0100
parents f0afece42f48
children
line wrap: on
line source

% MKLOWPASS return a low pass filter miir(). A Butterworth filter is used.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: MKLOWPASS return a low pass filter miir().
%              A Butterworth filter is used.
%
% CALL:        f = mklowpass(f, pl)
%
% VERSION: $Id: mklowpass.m,v 1.10 2011/04/04 11:37:02 hewitson Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function f = mklowpass(f, pl)

  g     = find(pl, 'gain');
  fc    = find(pl, 'fc');
  fs    = find(pl, 'fs');
  order = find(pl, 'order');

  utils.helper.checkFilterOptions(pl);

  % Build coefficients
  [a, b] = butter(order, 2*fc(1)/fs);

  % Set filter properties
  f.name    = 'lowpass';
  f.fs      = fs;
  f.a       = a.*g;
  f.b       = b;
  f.histin  = zeros(1,f.ntaps-1); % initialise input history
  f.histout = zeros(1,f.ntaps-1); % initialise output history
end