Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

iir_shelf.h

Go to the documentation of this file.
00001 // 
00002 // Copyright(c) 1993-1996 Tony Kirke
00003 // author="Tony Kirke" *
00004 /*
00005  * SPUC - Signal processing using C++ - A DSP library
00006  * 
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2, or (at your option)
00010  * any later version.
00011  * 
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  * 
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00020 */
00021 #ifndef IIR_SHELF
00022 #define IIR_SHELF
00023 namespace SPUC {
00026 //
00033 template <class Numeric> class iir_shelf
00034 {
00035     protected:   
00036         double a;
00037         double b;
00038         Numeric out;
00039         Numeric previous_out;
00040         Numeric previous_in;
00041         
00042  public:
00043         iir_shelf(double A=0,double B=0) : a(A),b(B) {
00044                 previous_in = previous_out = out = 0 ; }
00046                 Numeric clock(Numeric input) {
00047                         // Shift previous outputs and calculate new output */
00048                         out = ((1-b)*previous_out + (a+1)*input + (a-1)*previous_in)/(1+b);
00049                         previous_out = out;
00050                         previous_in = input;
00051                         return(out);
00052                 }
00054                 void reset() {
00055                         previous_in = previous_out = out = 0;
00056                 }
00057  };                                               
00058 } // namespace SPUC 
00059 #endif

Generated on Fri Sep 16 11:02:27 2005 for spuc by  doxygen 1.4.4