LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why does high-pass filtering distort data?

I am using an MCU to interrupt and read accelerometer data at a rate of 100Hz, and I want to calculate displacement. However, when I move the accelerometer, there inevitably appears to be an offset (zero calibration was performed at initialization) Many articles mention that high-pass filtering the velocity can make the calculation of displacement more accurate. However, as you can see from the diagram, once I apply a high-pass filter to the velocity signal, the signal becomes strange with bumps appearing. Is there any way to solve this? PS. I have attached the data (without high-pass filtering, and the actual displacement is around 19.7cm). X represents acceleration, Y represents velocity after the first integration, and Z represents displacement after the second integration.

koukileo_0-1707409660865.png

koukileo_0-1707409756092.png

 

 

0 Kudos
Message 1 of 9
(2,160 Views)

Well, your cutoff frequency is 100 hz and the Nyquist frequency is 50hz.   That is going to provide poor results. Try a cutoff around 20Hz 


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 9
(2,127 Views)

100Hz is the sampling frequency, and 0.075 is the cutoff frequency.

 

butterworth-filter-dbl-vi.png

Message 3 of 9
(2,104 Views)

I haven't done much with high-pass filtering so am not equipped to explain the tail end of the curve that looks similar to exponential decay.  I'm more familiar with low-pass filtering (though I'm not exactly an expert there either).

 

In any event, I would think you should be doing your high-pass filter *before* the integration step.  The purpose of the high-pass filter is to reject DC offset and near-DC drift so you don't integrate them into a velocity ramp or drift.  So you need to filter first, integrate second.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 4 of 9
(2,084 Views)

I think the problem is the integration function.  You have no starting values defined. If I were you I would just generate a running sum of your data to do the integration shown below.  That way, you don't have to worry about the initial conditions.  With the high-pass filter you just might set the cutoff to 0.005 Hz or lower just to isolate the DC value.  Kevin_P is correct in that the high-pass filter should be first.

 

 

rpursley8_0-1707430787620.png

 

Randall Pursley
0 Kudos
Message 5 of 9
(2,075 Views)

Even if I put the filter at the very beginning (acceleration), there is still no difference. 0.005Hz is too low, causing the offset to not be corrected.😞

koukileo_0-1707460751365.png