Home > classes > @miir > mkbandreject.m

mkbandreject

PURPOSE ^

MKBANDREJECT return a low pass filter miir(). A Butterworth filter is used.

SYNOPSIS ^

function f = mkbandreject(f, pl)

DESCRIPTION ^

 MKBANDREJECT return a low pass filter miir(). A Butterworth filter is used.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: MKBANDREJECT return a low pass filter miir().
              A Butterworth filter is used.

 CALL:        f = mkbandreject(f, pl)

 VERSION: $Id: mkbandreject.m,v 1.4 2008/08/06 15:03:50 ingo Exp $

 HISTORY: 27-08-2002 M Hewitson
             Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % MKBANDREJECT return a low pass filter miir(). A Butterworth filter is used.
0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0003 %
0004 % DESCRIPTION: MKBANDREJECT return a low pass filter miir().
0005 %              A Butterworth filter is used.
0006 %
0007 % CALL:        f = mkbandreject(f, pl)
0008 %
0009 % VERSION: $Id: mkbandreject.m,v 1.4 2008/08/06 15:03:50 ingo Exp $
0010 %
0011 % HISTORY: 27-08-2002 M Hewitson
0012 %             Creation
0013 %
0014 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0015 
0016 function f = mkbandreject(f, pl)
0017 
0018   g      = find(pl, 'gain');
0019   fc     = find(pl, 'fc');
0020   fs     = find(pl, 'fs');
0021   order  = find(pl, 'order');
0022   ripple = find(pl, 'ripple');
0023 
0024   if(fc > fs/2)
0025     error('fc must be < fs/2');
0026   end
0027   if(fc(1) > fc(2))
0028     error('fc(1) must be < fc(2)');
0029   end
0030 
0031   % Build filter coefficients
0032   [a, b] = cheby1(order, ripple, 2.*fc./fs, 'stop');
0033 
0034   % Set filter properties
0035   f.setName('bandreject', 'internal');
0036   f.setFs(fs);
0037   f.setA(g.*a);
0038   f.setB(b);
0039   f.setHistin(zeros(1,f.ntaps-1));   % initialise input history
0040   f.setHistout(zeros(1,f.ntaps-1));   % initialise output history
0041 
0042

Generated on Mon 08-Sep-2008 13:18:47 by m2html © 2003