Main Page | Modules | Namespace List | Class Hierarchy | Compound List | File List | Compound 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 
00033 class gr_firdes {
00034  public:
00035 
00036   enum win_type {
00037     WIN_HAMMING = 0,    // max attenuation 53 dB
00038     WIN_HANN = 1,       // max attenuation 44 dB
00039     WIN_BLACKMAN = 2,   // max attenuation 74 dB
00040     WIN_RECTANGULAR = 3
00041   };
00042 
00043   // ... class methods ...
00044 
00059   static std::vector<float>
00060   low_pass (double gain,
00061             double sampling_freq,
00062             double cutoff_freq,         // Hz center of transition band
00063             double transition_width,    // Hz width of transition band
00064             win_type window = WIN_HAMMING,
00065             double beta = 6.76);                // used only with Kaiser
00066 
00081   static std::vector<float>
00082   high_pass (double gain,
00083              double sampling_freq,
00084              double cutoff_freq,                // Hz center of transition band
00085              double transition_width,           // Hz width of transition band
00086              win_type window = WIN_HAMMING,
00087              double beta = 6.76);               // used only with Kaiser
00088 
00104   static std::vector<float>
00105   band_pass (double gain,
00106              double sampling_freq,
00107              double low_cutoff_freq,            // Hz center of transition band
00108              double high_cutoff_freq,           // Hz center of transition band
00109              double transition_width,           // Hz width of transition band
00110              win_type window = WIN_HAMMING,
00111              double beta = 6.76);               // used only with Kaiser
00112 
00113 
00129   static std::vector<float>
00130   band_reject (double gain,
00131                double sampling_freq,
00132                double low_cutoff_freq,          // Hz center of transition band
00133                double high_cutoff_freq,         // Hz center of transition band
00134                double transition_width,         // Hz width of transition band
00135                win_type window = WIN_HAMMING,
00136                double beta = 6.76);             // used only with Kaiser
00137 
00144   static std::vector<float>
00145   hilbert (unsigned int ntaps,
00146            win_type windowtype = WIN_RECTANGULAR,
00147            double beta = 6.76);
00148    
00158   static std::vector<float>
00159   root_raised_cosine (double gain,
00160                       double sampling_freq,
00161                       double symbol_rate,       // Symbol rate, NOT bitrate (unless BPSK)
00162                       double alpha,             // Excess Bandwidth Factor
00163                       int ntaps);
00164 
00173   static std::vector<float>
00174   gaussian (double gain,
00175             double sampling_freq,
00176             double symbol_rate,       
00177             double bt,              // Bandwidth to bitrate ratio
00178             int ntaps);
00179 
00180   // window functions ...
00181   static std::vector<float> gr_firdes::window (win_type type, int ntaps, double beta);
00182 
00183   // reverse the order of taps
00184   static std::vector<float> reverse (const std::vector<float> &taps);
00185 
00186 private:
00187   static void sanity_check_1f (double sampling_freq, double f1,
00188                                double transition_width);
00189   static void sanity_check_2f (double sampling_freq, double f1, double f2,
00190                                double transition_width);
00191 
00192   static int compute_ntaps (double sampling_freq,
00193                             double transition_width,
00194                             win_type window_type, double beta);
00195 };
00196 
00197 #endif

Generated on Tue Mar 29 19:56:34 2005 for GNU Radio 2.x by doxygen 1.3.2