GNU Radio Manual and C++ API Reference  3.8.1.0
The Free & Open Software Radio Ecosystem
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 <stdexcept>
29 #include <string>
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 response given a set of band edges, the desired
40  * response 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) \param filter_type
47  *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> pm_remez(int order,
61  const std::vector<double>& bands,
62  const std::vector<double>& ampl,
63  const std::vector<double>& error_weight,
64  const std::string filter_type = "bandpass",
65  int grid_density = 16) noexcept(false);
66 
67 } /* namespace filter */
68 } /* namespace gr */
69 
70 #endif /* INCLUDED_FILTER_PM_REMEZ_H */
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:43
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) noexcept(false)
Parks-McClellan FIR filter design using Remez algorithm.
#define FILTER_API
Definition: gr-filter/include/gnuradio/filter/api.h:30