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

gr_firdes.h

Go to the documentation of this file.
00001 /* -*- c++ -*- */
00002 /*
00003  * Copyright 2002 Free Software Foundation, Inc.
00004  * 
00005  * This file is part of GNU Radio
00006  * 
00007  * GNU Radio 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  * GNU Radio 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 GNU Radio; see the file COPYING.  If not, write to
00019  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00020  * Boston, MA 02111-1307, USA.
00021  */
00022 
00023 #ifndef _GR_FIRDES_H_
00024 #define _GR_FIRDES_H_
00025 
00026 #include <vector>
00027 #include <cmath>
00028 #include <gr_complex.h>
00029 
00034 class gr_firdes {
00035  public:
00036 
00037   enum win_type {
00038     WIN_HAMMING = 0,    // max attenuation 53 dB
00039     WIN_HANN = 1,       // max attenuation 44 dB
00040     WIN_BLACKMAN = 2,   // max attenuation 74 dB
00041     WIN_RECTANGULAR = 3,
00042     WIN_KAISER = 4      // max attenuation a function of beta, google it
00043   };
00044 
00045 
00046   // ... class methods ...
00047 
00062   static std::vector<float>
00063   low_pass (double gain,
00064             double sampling_freq,
00065             double cutoff_freq,         // Hz center of transition band
00066             double transition_width,    // Hz width of transition band
00067             win_type window = WIN_HAMMING,
00068             double beta = 6.76);                // used only with Kaiser
00069 
00084   static std::vector<float>
00085   high_pass (double gain,
00086              double sampling_freq,
00087              double cutoff_freq,                // Hz center of transition band
00088              double transition_width,           // Hz width of transition band
00089              win_type window = WIN_HAMMING,
00090              double beta = 6.76);               // used only with Kaiser
00091 
00107   static std::vector<float>
00108   band_pass (double gain,
00109              double sampling_freq,
00110              double low_cutoff_freq,            // Hz center of transition band
00111              double high_cutoff_freq,           // Hz center of transition band
00112              double transition_width,           // Hz width of transition band
00113              win_type window = WIN_HAMMING,
00114              double beta = 6.76);               // used only with Kaiser
00115 
00116 
00133   static std::vector<gr_complex>
00134   complex_band_pass (double gain,
00135              double sampling_freq,
00136              double low_cutoff_freq,            // Hz center of transition band
00137              double high_cutoff_freq,           // Hz center of transition band
00138              double transition_width,           // Hz width of transition band
00139              win_type window = WIN_HAMMING,
00140              double beta = 6.76);               // used only with Kaiser
00141 
00142 
00159   static std::vector<float>
00160   band_reject (double gain,
00161                double sampling_freq,
00162                double low_cutoff_freq,          // Hz center of transition band
00163                double high_cutoff_freq,         // Hz center of transition band
00164                double transition_width,         // Hz width of transition band
00165                win_type window = WIN_HAMMING,
00166                double beta = 6.76);             // used only with Kaiser
00167 
00174   static std::vector<float>
00175   hilbert (unsigned int ntaps,
00176            win_type windowtype = WIN_RECTANGULAR,
00177            double beta = 6.76);
00178    
00188   static std::vector<float>
00189   root_raised_cosine (double gain,
00190                       double sampling_freq,
00191                       double symbol_rate,       // Symbol rate, NOT bitrate (unless BPSK)
00192                       double alpha,             // Excess Bandwidth Factor
00193                       int ntaps);
00194 
00202   static std::vector<float>
00203   gaussian (double gain,
00204             double spb,       
00205             double bt,              // Bandwidth to bitrate ratio
00206             int ntaps);
00207 
00208   // window functions ...
00209   static std::vector<float> window (win_type type, int ntaps, double beta);
00210 
00211 private:
00212   static double bessi0(double x);
00213   static void sanity_check_1f (double sampling_freq, double f1,
00214                                double transition_width);
00215   static void sanity_check_2f (double sampling_freq, double f1, double f2,
00216                                double transition_width);
00217   static void sanity_check_2f_c (double sampling_freq, double f1, double f2,
00218                                double transition_width);
00219 
00220   static int compute_ntaps (double sampling_freq,
00221                             double transition_width,
00222                             win_type window_type, double beta);
00223 };
00224 
00225 #endif

Generated on Sat Jul 8 17:04:51 2006 for GNU Radio 2.x by  doxygen 1.4.1