Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

178
Views
Javascript Low-pass filter

How to properly apply a low pass filter in javascript? I'm not sure if my doing is correct or not. And I can't find a good example in javascript language

I tried using this but it returns NaN

 // Use a basic low-pass filter to keep only the gravity component of each axis.
 var grav_accelX = (acceleration.x * kFilteringFactor) + ( grav_accelX * (1.0 - kFilteringFactor));
 var grav_accelY = (acceleration.y * kFilteringFactor) + ( grav_accelY * (1.0 - kFilteringFactor));
 var grav_accelZ = (acceleration.z * kFilteringFactor) + ( grav_accelZ * (1.0 - kFilteringFactor));

So what I did is like this. It gives value but I'm not sure if this is the proper way.

const kFilteringFactor = 0.9
var accelX = x * kFilteringFactor
var accelY = y * kFilteringFactor
var accelZ = z * kFilteringFactor

accelX = accelX * (1.0 - kFilteringFactor)
accelY = accelY * (1.0 - kFilteringFactor)
accelZ = accelZ * (1.0 - kFilteringFactor)

The inline grav_accelX variable seems like not working here's the example

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!