From 6e7e606ba5d7644aa60a8859ffc215b7952c9ca0 Mon Sep 17 00:00:00 2001 From: Bernd Porr Date: Mon, 15 Apr 2024 13:41:22 +0100 Subject: [PATCH] Added info about moving average --- Fir1.h | 5 +++-- README.md | 12 +++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Fir1.h b/Fir1.h index bc1512d..4a0efc8 100644 --- a/Fir1.h +++ b/Fir1.h @@ -74,9 +74,10 @@ class Fir1 { Fir1(const char* coeffFile, unsigned number_of_taps = 0); /** - * Inits all coefficients and the buffer to a constant value + * Inits all coefficients and the buffer to a constant value. * This is useful for adaptive filters where we start with - * zero valued coefficients or moving average filters. + * zero valued coefficients or moving average filters with + * value = 1.0/number_of_taps. **/ Fir1(unsigned number_of_taps, double value = 0); diff --git a/README.md b/README.md index 4612444..5fe37f8 100644 --- a/README.md +++ b/README.md @@ -44,6 +44,7 @@ By default optimised release libraries are generated. Under windows only the static library is generated which should be used for your code development. +For example for Visual Studio 2019 you write: ``` cmake -G "Visual Studio 16 2019" -A x64 . ``` @@ -66,7 +67,7 @@ for an instructional example. Windows / Linux / Mac ``` - pip3 install fir1 +pip install fir1 ``` under Windows it might be just `pip` for python3. @@ -75,7 +76,7 @@ under Windows it might be just `pip` for python3. Windows / Linux / Mac: make sure that you have swig and a C++ compiler installed. Then type: ``` - python3 setup.py install +python setup.py install ``` @@ -137,7 +138,12 @@ or import the coefficients as a const double array: Fir1 fir(coefficients) ``` there is also an option to import a non-const array (for example -generated with the ifft) and using std::vector. +generated with the ifft) and using std::vector. You can also +create a moving average filter by initialising all coefficients +with a constant value: +``` +Fir1 moving_average(100,1.0/100); +``` #### C++ integer FIR filter: ```