Giter VIP home page Giter VIP logo

Comments (1)

treastorgavin avatar treastorgavin commented on June 12, 2024

Hi AGG2017,

Looking at the code, we can calculate the coefficients of the notch filter for power lines at 60Hz, assuming a sampling frequency of 500Hz (from arduino.ino).

H(z) = (z-1)/(z-a) where a is within 0-1, the closer a is to 1 the tighter the notch.
to normalize DC unity we multiply H(z) by (1+a)/2
our wn is fo/fc = (60/500)2pi = 0.75398
rotating poles and zeros of z and plugging into H(z)
with a = 0.99 (close to 1 as we want a tight notch since we only want to get rid of 60Hz)
and wn = 0.75398
H(z) = ((1+a)/2) ((z^2) - 2
zcos(wn) +1)/ ( (z^2) - 2azcos(wn) + (a^2))
H(z) = (0.995 - 1.999z^(-1) + 0.995z^(-2) ) / (1- 1.979z^(-1) + 0.9801z^(-2))

Solving the coefficients using inverse z transform

y[n] - 1.979 y[n-1] + 0.9801 y[n-2] = 0.995 x[n] - 1.999 x[n-1] + 0.995 x[n-2]

b coeff = 0.995, -1.999, 0.995
a coeff = 1, -1.979, 0.9801

I would try:

y = 0.995 * x - 1.999* x1 + 0.995 * x2 + 1.979 * y1 - 0.9801 * y2;

for a 60Hz notch filter

from ecg-acquisition-classification.

Related Issues (1)

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.