Skip to content

Commit

Permalink
Merge pull request #221 from Jalmenara/improve-iir-filters-docs
Browse files Browse the repository at this point in the history
Improve iir filters docs
  • Loading branch information
dancazarin authored Mar 26, 2024
2 parents 0dd0fd1 + b186c7c commit f748564
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/cxxdox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ groups:
string_io: "String conversion/printing values"
biquad: "Biquad filter and design functions"
fir: "FIR filter and design functions"
iir: "IIR filter and design functions"
window: "Window functions"
sample_rate_conversion: "Sample rate conversion"
oscillators: "Oscillator functions"
Expand Down
33 changes: 32 additions & 1 deletion include/kfr/dsp/iir_design.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @addtogroup biquad
/** @addtogroup iir
* @{
*/
/*
Expand Down Expand Up @@ -1030,6 +1030,13 @@ KFR_FUNCTION T warp_freq(T frequency, T fs)

} // namespace internal

/**
* @brief Calculates zero-pole-gain coefficients for the low-pass IIR filter
* @param filter Filter type: chebyshev1, chebyshev2, bessel, butterworth
* @param frequency Cutoff frequency (Hz)
* @param fs Sampling frequency (Hz)
* @return The resulting zpk filter
*/
template <typename T>
KFR_FUNCTION zpk<T> iir_lowpass(const zpk<T>& filter, identity<T> frequency, identity<T> fs = T(2.0))
{
Expand All @@ -1041,6 +1048,14 @@ KFR_FUNCTION zpk<T> iir_lowpass(const zpk<T>& filter, identity<T> frequency, ide
return result;
}


/**
* @brief Calculates zero-pole-gain coefficients for the high-pass IIR filter
* @param filter Filter type: chebyshev1, chebyshev2, bessel, butterworth
* @param frequency Cutoff frequency (Hz)
* @param fs Sampling frequency (Hz)
* @return The resulting zpk filter
*/
template <typename T>
KFR_FUNCTION zpk<T> iir_highpass(const zpk<T>& filter, identity<T> frequency, identity<T> fs = T(2.0))
{
Expand All @@ -1052,6 +1067,14 @@ KFR_FUNCTION zpk<T> iir_highpass(const zpk<T>& filter, identity<T> frequency, id
return result;
}

/**
* @brief Calculates zero-pole-gain coefficients for the band-pass IIR filter
* @param filter Filter type: chebyshev1, chebyshev2, bessel, butterworth
* @param lowfreq Low cutoff frequency (Hz)
* @param lowfreq High cutoff frequency (Hz)
* @param fs Sampling frequency (Hz)
* @return The resulting zpk filter
*/
template <typename T>
KFR_FUNCTION zpk<T> iir_bandpass(const zpk<T>& filter, identity<T> lowfreq, identity<T> highfreq,
identity<T> fs = T(2.0))
Expand All @@ -1065,6 +1088,14 @@ KFR_FUNCTION zpk<T> iir_bandpass(const zpk<T>& filter, identity<T> lowfreq, iden
return result;
}

/**
* @brief Calculates zero-pole-gain coefficients for the band-stop IIR filter
* @param filter Filter type: chebyshev1, chebyshev2, bessel, butterworth
* @param lowfreq Low cutoff frequency (Hz)
* @param lowfreq High cutoff frequency (Hz)
* @param fs Sampling frequency (Hz)
* @return The resulting zpk filter
*/
template <typename T>
KFR_FUNCTION zpk<T> iir_bandstop(const zpk<T>& filter, identity<T> lowfreq, identity<T> highfreq,
identity<T> fs = T(2.0))
Expand Down

0 comments on commit f748564

Please sign in to comment.