Git Product home page Git Product logo

digitalfilters's Introduction

DigitalFilters

Pre-requisite to run examples with little effort:

  • macos 14.2.1 / linux-ubuntu >= 18.04 (only tested in macos, but will likely to work on linux provided that the following packages are installed properly)
  • cmake >= 3.20
  • python >= 3.9
  • matplotlib >= 3.7.1
  • pandas >= 2.2.1

This library contains selection of digital filter functions implemented in C++.

As a starting point, low-pass filter, high-pass filter, notch filter and hanning filters have been implemented and examples are provided.

Hanning filter outputs a signal which is a scaled average of three successive inputs, with the centre point of the three weighted twice as heavily as its two adjacent neighbours.

In Figure 1 and 2, combination of two discrete sine waves are filtered with Ts = 0.01 seconds and w_c = 2 Hz and 10 Hz.

In Figure 3 and 4, combination of two discrete sine waves are filtered with Ts = 0.01 seconds, w_c = 35 Hz and 50 Hz. Sine wave which has lower frequency is almost filtered out.

In Figures 5, 6 and 7, pure sine waves which have an amplitude of 2.0 and sampling time of 0.01 seconds filtered by notch filters which have different bandwidth parameters and notch frequencies of w_c = 2.5 Hz and 5 Hz. The effect of bandwidth parameter on the precision and response of the filter can be observed. In addition to this, the effect of corner frequency can be also clearly observed. If the corner frequency of the filter is set to close to the sine wave frequency, sine wave is almost flattened. Further experiments are possible with the given main function. Play around with the parameters and have fun!

In Figure 8, combination of two discrete sine waves are filtered with hanning filter which averages 3 consecutive inputs to the filter.

Low-pass Filter Example

Example

Figure 1: Filtered and unfiltered signals, inputs: w_sine1 = 1Hz + w_sine2 = 20Hz, w_c = 2Hz

Example

Figure 2: Filtered and unfiltered signals, inputs: w_sine1 = 1Hz + w_sine2 = 20Hz, w_c = 10Hz

High-pass Filter Example

Example

Figure 3: Filtered and unfiltered signals, inputs: w_sine1 = 1Hz + w_sine2 = 40Hz, w_c = 35Hz

Example

Figure 4: Filtered and unfiltered signals, inputs: w_sine1 = 1Hz + w_sine2 = 40Hz, w_c = 50Hz

Notch Filter Examples

Example

Figure 5: Filtered and unfiltered 2.5Hz sine signal, filter bandwidth parameter = 0.25

Example

Figure 6: Filtered and unfiltered 5.0Hz sine signal, filter bandwidth parameter = 0.25

Example

Figure 7: Filtered and unfiltered 5Hz sine signal, filter bandwidth parameter = 0.98

Hanning Filter Example

Example

Figure 8: Filtered and unfiltered signals, inputs: w_sine1 = 1Hz + w_sine2 = 15Hz

digitalfilters's People

Contributors

ozangerger avatar

Stargazers

 avatar

Watchers

 avatar

digitalfilters's Issues

AEC Filter

Maybe for the next project as opensource AI would really benefit from some new low load SoC based filter methods :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.