00001 /* 00002 * ---------------------------------------------------------------------------- 00003 * "THE BEER-WARE LICENSE" (Revision 42): 00004 * As long as you retain this notice you can do whatever you want with this 00005 * stuff. If we meet some day, and you think this stuff is worth it, you can 00006 * buy me a beer in return. 00007 * - Joe Romano and Will McMahan 00008 * ---------------------------------------------------------------------------- 00009 */ 00010 //@author Joe Romano 00011 //@author Will McMahan 00012 //@email joeromano@gmail.com 00013 //@brief digitalFilter.h - class to create IIR and FIR digital filter 00014 // coefficients in the Matlab (2010) style. This style being vectors 00015 // of coefficients for the numberator (b) and denominator (a) 00016 // respectively. 00017 // Please refer to the matlab documentation page for implementation 00018 // details: http://www.mathworks.com/access/helpdesk/help/techdoc/ref/filter.html 00019 00020 #ifndef _DIGITALFILTER_H_ 00021 #define _DIGITALFILTER_H_ 00022 00023 class digitalFilter 00024 { 00025 00026 public: 00027 // Constructors 00028 digitalFilter(int filterOrder_userdef, bool isIIR); 00029 digitalFilter(int filterOrder_userdef, bool isIIR, float *b_userdef, float *a_userdef); 00030 00031 ~digitalFilter(void); // Destructor 00032 00033 float getNextFilteredValue(float u_current); 00034 00035 protected: 00036 float *a, *b; // filter coefficients 00037 float *u, *x; // filter input and output states 00038 00039 private: 00040 int filterOrder; 00041 bool IIR; 00042 00043 }; 00044 00045 #endif 00046