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

elliptic.h

Go to the documentation of this file.
00001 // 
00002 // author="Tony Kirke"
00003 // Copyright(c) 2005 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 #include <iostream>
00022 #include <fstream>
00023 #include <stdio.h>
00024 #include <spuc.h>
00025 #include <math.h>
00026 #include <complex.h>
00027 #include <spuc_math.h>
00028 #include <iir_1st.h>
00029 #include <iir_2nd.h>
00030 using namespace std;
00031 namespace SPUC {
00039 
00040 
00041 
00042 class elliptic
00043 {
00044  private:
00045         long order;
00046         long odd;
00047         long n2;
00048         complex<double>* roots;
00049         complex<double>* zeros;
00050         iir_2nd<double>* iir;
00051         iir_1st<double>* iir_1;
00052         double gain;
00053         double* coeff;
00054         double epi;
00055 
00056  public:
00061         elliptic(double fcd, long ord=1, double stopattn = 60.0, double ripple=0.1);
00063         ~elliptic() {
00064           delete [] roots;
00065           delete [] zeros;
00066           if (odd) delete iir_1;
00067           delete [] iir;
00068         }
00070         void reset();
00072         void print();
00074         double clock(double in);
00075  private:
00077         void bilinear(long n2,complex<double>* r);
00079         void get_coeff(long n2);
00080         void get_roots(double ripple, double stopbandAtten, long order);
00081         double lamda_plane(double k, double m, int n, double eps);
00082         void s_plane(int n, double u, double m, double k, double Kk, double wca);
00083         // elliptic functions......
00084         double ellik(double phi,double k);
00085         double ellpk(double k);
00086         int ellpj( double u, double m, double* sn, double* cn, double* dn);
00087         double msqrt(double q);
00088 };
00089 } // namespace SPUC 

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