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 3, 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., 51 Franklin Street,
00020  * Boston, MA 02110-1301, 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 
00035 class gr_firdes {
00036  public:
00037 
00038   enum win_type {
00039     WIN_HAMMING = 0,    // max attenuation 53 dB
00040     WIN_HANN = 1,       // max attenuation 44 dB
00041     WIN_BLACKMAN = 2,   // max attenuation 74 dB
00042     WIN_RECTANGULAR = 3,
00043     WIN_KAISER = 4      // max attenuation a function of beta, google it
00044   };
00045 
00046 
00047   // ... class methods ...
00048 
00063   static std::vector<float>
00064   low_pass (double gain,
00065             double sampling_freq,
00066             double cutoff_freq,         // Hz center of transition band
00067             double transition_width,    // Hz width of transition band
00068             win_type window = WIN_HAMMING,
00069             double beta = 6.76);                // used only with Kaiser
00070 
00085   static std::vector<float>
00086   high_pass (double gain,
00087              double sampling_freq,
00088              double cutoff_freq,                // Hz center of transition band
00089              double transition_width,           // Hz width of transition band
00090              win_type window = WIN_HAMMING,
00091              double beta = 6.76);               // used only with Kaiser
00092 
00108   static std::vector<float>
00109   band_pass (double gain,
00110              double sampling_freq,
00111              double low_cutoff_freq,            // Hz center of transition band
00112              double high_cutoff_freq,           // Hz center of transition band
00113              double transition_width,           // Hz width of transition band
00114              win_type window = WIN_HAMMING,
00115              double beta = 6.76);               // used only with Kaiser
00116 
00117 
00134   static std::vector<gr_complex>
00135   complex_band_pass (double gain,
00136              double sampling_freq,
00137              double low_cutoff_freq,            // Hz center of transition band
00138              double high_cutoff_freq,           // Hz center of transition band
00139              double transition_width,           // Hz width of transition band
00140              win_type window = WIN_HAMMING,
00141              double beta = 6.76);               // used only with Kaiser
00142 
00143 
00160   static std::vector<float>
00161   band_reject (double gain,
00162                double sampling_freq,
00163                double low_cutoff_freq,          // Hz center of transition band
00164                double high_cutoff_freq,         // Hz center of transition band
00165                double transition_width,         // Hz width of transition band
00166                win_type window = WIN_HAMMING,
00167                double beta = 6.76);             // used only with Kaiser
00168 
00175   static std::vector<float>
00176   hilbert (unsigned int ntaps = 19,
00177            win_type windowtype = WIN_RECTANGULAR,
00178            double beta = 6.76);
00179    
00189   static std::vector<float>
00190   root_raised_cosine (double gain,
00191                       double sampling_freq,
00192                       double symbol_rate,       // Symbol rate, NOT bitrate (unless BPSK)
00193                       double alpha,             // Excess Bandwidth Factor
00194                       int ntaps);
00195 
00203   static std::vector<float>
00204   gaussian (double gain,
00205             double spb,       
00206             double bt,              // Bandwidth to bitrate ratio
00207             int ntaps);
00208 
00209   // window functions ...
00210   static std::vector<float> window (win_type type, int ntaps, double beta);
00211 
00212 private:
00213   static double bessi0(double x);
00214   static void sanity_check_1f (double sampling_freq, double f1,
00215                                double transition_width);
00216   static void sanity_check_2f (double sampling_freq, double f1, double f2,
00217                                double transition_width);
00218   static void sanity_check_2f_c (double sampling_freq, double f1, double f2,
00219                                double transition_width);
00220 
00221   static int compute_ntaps (double sampling_freq,
00222                             double transition_width,
00223                             win_type window_type, double beta);
00224 };
00225 
00226 #endif

Generated on Thu Mar 5 09:01:10 2009 for GNU Radio 3.1.3 by  doxygen 1.5.8