GNU Radio 3.7.3 C++ API
pm_remez.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2004,2012 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef INCLUDED_FILTER_PM_REMEZ_H
24 #define INCLUDED_FILTER_PM_REMEZ_H
25 
26 #include <gnuradio/filter/api.h>
27 #include <gnuradio/types.h>
28 #include <string>
29 #include <stdexcept>
30 
31 namespace gr {
32  namespace filter {
33  /*!
34  * \brief Parks-McClellan FIR filter design using Remez algorithm.
35  * \ingroup filter_design
36  *
37  * \details
38  * Calculates the optimal (in the Chebyshev/minimax sense) FIR
39  * filter inpulse reponse given a set of band edges, the desired
40  * reponse on those bands, and the weight given to the error in
41  * those bands.
42  *
43  * \param order filter order (number of taps in the returned filter - 1)
44  * \param bands frequency at the band edges [ b1 e1 b2 e2 b3 e3 ...]
45  * \param ampl desired amplitude at the band edges [ a(b1) a(e1) a(b2) a(e2) ...]
46  * \param error_weight weighting applied to each band (usually 1)
47  * \param filter_type one of "bandpass", "hilbert" or "differentiator"
48  * \param grid_density determines how accurately the filter will be constructed. \
49  * The minimum value is 16; higher values are slower to compute.
50  *
51  * Frequency is in the range [0, 1], with 1 being the Nyquist
52  * frequency (Fs/2)
53  *
54  * \returns vector of computed taps
55  *
56  * \throws std::runtime_error if args are invalid or calculation
57  * fails to converge.
58  */
59 
60  FILTER_API std::vector<double>
61  pm_remez(int order,
62  const std::vector<double> &bands,
63  const std::vector<double> &ampl,
64  const std::vector<double> &error_weight,
65  const std::string filter_type = "bandpass",
66  int grid_density = 16
67  ) throw (std::runtime_error);
68 
69  } /* namespace filter */
70 } /* namespace gr */
71 
72 #endif /* INCLUDED_FILTER_PM_REMEZ_H */
FILTER_API std::vector< double > pm_remez(int order, const std::vector< double > &bands, const std::vector< double > &ampl, const std::vector< double > &error_weight, const std::string filter_type="bandpass", int grid_density=16)
Parks-McClellan FIR filter design using Remez algorithm.
#define FILTER_API
Definition: gr-filter/include/gnuradio/filter/api.h:30