nk 1.0.0
C++ Numerical Computing Runtime
Loading...
Searching...
No Matches
iir_designs.hpp
Go to the documentation of this file.
1
3// toolboxes/signal/include/nk/signal/filter_design/iir_designs.hpp
4//
5// Top-level IIR filter designs that compose the analog prototypes
6// (cheb1ap / cheb2ap / besselap / ellipap) with the LP→{HP,BP,BS}
7// frequency transforms, zp2tf, and bilinear.
8
9#pragma once
10
11#include <memory_resource>
12#include <nk/value/value.hpp>
13
14#include <string>
15#include <string_view>
16#include <tuple>
17
18namespace nk::signal {
19
22
23
31
56std::tuple<Value, Value>
57cheby1(int N,
58 double Rp,
59 const Value & Wn,
61 bool analog = false,
62 std::pmr::memory_resource * mr = nullptr);
63
77std::tuple<Value, Value>
78cheby2(int N,
79 double Rs,
80 const Value & Wn,
82 bool analog = false,
83 std::pmr::memory_resource * mr = nullptr);
84
98std::tuple<Value, Value>
99besself(int N,
100 const Value & Wn,
102 bool analog = false,
103 std::pmr::memory_resource * mr = nullptr);
104
113std::tuple<Value, Value>
114butter(int N,
115 const Value & Wn,
117 bool analog = false,
118 std::pmr::memory_resource * mr = nullptr);
119
133std::tuple<Value, Value>
134ellip(int N,
135 double Rp,
136 double Rs,
137 const Value & Wn,
139 bool analog = false,
140 std::pmr::memory_resource * mr = nullptr);
141
142// ─────────────────────────────────────────────────────────────────────
143// Order estimators — pick the minimum order to meet given specs.
144// ─────────────────────────────────────────────────────────────────────
145
167std::tuple<int, Value>
168buttord(const Value & Wp,
169 const Value & Ws,
170 double Rp,
171 double Rs,
172 bool analog = false,
173 std::pmr::memory_resource * mr = nullptr);
174
183std::tuple<int, Value>
184cheb1ord(const Value &Wp, const Value &Ws, double Rp, double Rs,
185 bool analog = false,
186 std::pmr::memory_resource *mr = nullptr);
187
196std::tuple<int, Value>
197cheb2ord(const Value &Wp, const Value &Ws, double Rp, double Rs,
198 bool analog = false,
199 std::pmr::memory_resource *mr = nullptr);
200
211std::tuple<int, Value>
212ellipord(const Value &Wp, const Value &Ws, double Rp, double Rs,
213 bool analog = false,
214 std::pmr::memory_resource *mr = nullptr);
215
234std::tuple<int, Value, Value, Value>
235firpmord(const Value & F,
236 const Value & A,
237 const Value & dev,
238 double fs = 2.0,
239 std::pmr::memory_resource * mr = nullptr);
240
255std::tuple<int, Value, double, std::string>
256kaiserord(const Value & F,
257 const Value & A,
258 const Value & dev,
259 double fs = 2.0,
260 std::pmr::memory_resource * mr = nullptr);
261
262
264} // namespace nk::signal
Core MATLAB-compatible multidimensional array and scalar value type.
Definition value.hpp:61
std::tuple< int, Value > cheb1ord(const Value &Wp, const Value &Ws, double Rp, double Rs, bool analog=false, std::pmr::memory_resource *mr=nullptr)
Chebyshev type-I order estimator ([N, Wn] = cheb1ord(Wp, Ws, Rp, Rs, analog)).
std::tuple< Value, Value > cheby1(int N, double Rp, const Value &Wn, FilterType ftype=FilterType::Lowpass, bool analog=false, std::pmr::memory_resource *mr=nullptr)
Chebyshev type-I IIR filter design.
std::tuple< Value, Value > cheby2(int N, double Rs, const Value &Wn, FilterType ftype=FilterType::Lowpass, bool analog=false, std::pmr::memory_resource *mr=nullptr)
Chebyshev type-II (inverse Chebyshev) IIR filter design.
FilterType
Filter response type for IIR designs.
std::tuple< int, Value, double, std::string > kaiserord(const Value &F, const Value &A, const Value &dev, double fs=2.0, std::pmr::memory_resource *mr=nullptr)
Kaiser-window FIR order estimator.
std::tuple< int, Value, Value, Value > firpmord(const Value &F, const Value &A, const Value &dev, double fs=2.0, std::pmr::memory_resource *mr=nullptr)
Parks-McClellan FIR order estimator.
std::tuple< int, Value > buttord(const Value &Wp, const Value &Ws, double Rp, double Rs, bool analog=false, std::pmr::memory_resource *mr=nullptr)
Butterworth filter order estimator.
std::tuple< int, Value > cheb2ord(const Value &Wp, const Value &Ws, double Rp, double Rs, bool analog=false, std::pmr::memory_resource *mr=nullptr)
Chebyshev type-II order estimator ([N, Wn] = cheb2ord(Wp, Ws, Rp, Rs, analog)).
std::tuple< Value, Value > besself(int N, const Value &Wn, FilterType ftype=FilterType::Lowpass, bool analog=false, std::pmr::memory_resource *mr=nullptr)
Bessel-Thompson IIR filter design.
std::tuple< Value, Value > ellip(int N, double Rp, double Rs, const Value &Wn, FilterType ftype=FilterType::Lowpass, bool analog=false, std::pmr::memory_resource *mr=nullptr)
Elliptic (Cauer) IIR filter design.
std::tuple< Value, Value > butter(int N, double Wn, const std::string &type="low", std::pmr::memory_resource *mr=nullptr)
Butterworth IIR lowpass / highpass filter design.
std::tuple< int, Value > ellipord(const Value &Wp, const Value &Ws, double Rp, double Rs, bool analog=false, std::pmr::memory_resource *mr=nullptr)
Elliptic (Cauer) order estimator ([N, Wn] = ellipord(Wp, Ws, Rp, Rs, analog)).
@ Highpass
Pass above the cutoff, stop below.
@ Bandpass
Pass between two cutoffs.
@ Bandstop
Stop between two cutoffs, pass elsewhere.
@ Lowpass
Pass below the cutoff, stop above.