00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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,
00039 WIN_HANN = 1,
00040 WIN_BLACKMAN = 2,
00041 WIN_RECTANGULAR = 3,
00042 WIN_KAISER = 4
00043 };
00044
00045
00046
00047
00062 static std::vector<float>
00063 low_pass (double gain,
00064 double sampling_freq,
00065 double cutoff_freq,
00066 double transition_width,
00067 win_type window = WIN_HAMMING,
00068 double beta = 6.76);
00069
00084 static std::vector<float>
00085 high_pass (double gain,
00086 double sampling_freq,
00087 double cutoff_freq,
00088 double transition_width,
00089 win_type window = WIN_HAMMING,
00090 double beta = 6.76);
00091
00107 static std::vector<float>
00108 band_pass (double gain,
00109 double sampling_freq,
00110 double low_cutoff_freq,
00111 double high_cutoff_freq,
00112 double transition_width,
00113 win_type window = WIN_HAMMING,
00114 double beta = 6.76);
00115
00116
00133 static std::vector<gr_complex>
00134 complex_band_pass (double gain,
00135 double sampling_freq,
00136 double low_cutoff_freq,
00137 double high_cutoff_freq,
00138 double transition_width,
00139 win_type window = WIN_HAMMING,
00140 double beta = 6.76);
00141
00142
00159 static std::vector<float>
00160 band_reject (double gain,
00161 double sampling_freq,
00162 double low_cutoff_freq,
00163 double high_cutoff_freq,
00164 double transition_width,
00165 win_type window = WIN_HAMMING,
00166 double beta = 6.76);
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,
00192 double alpha,
00193 int ntaps);
00194
00202 static std::vector<float>
00203 gaussian (double gain,
00204 double spb,
00205 double bt,
00206 int ntaps);
00207
00208
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