LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error in filtering data that shows up as a "spike" in the data

Solved!
Go to solution

I have 9 accelerometers connected to NI 9237 modules. I collect the data and then after data collection I apply a butterworth filter and then do some calculations to get acceleration, etc. and then plot the results in Labview. The raw data does not have any "spike" or initial peak but something is happening between data collection and the butterworth filter I am applying. I know it is between those two processes because I export the data after the daq is done running and that data does not have any initial spike. Then I exported one of the channels after the butterworth filter and the spike is there. Is this spike indicative of an error in the filter? If so, what's happening and how do I fix? I don't want to just remove the first bit of data if the error is showing that there is a bigger problem. Note that the spike is there even if I just run the daq and don't move/impact the accelerometers.

 

Also, I am attaching a screenshot of where the filter is applied. filter type is lowpass; cutoff freq is 1000 hz and sampling freq is 20k. Not sure if this matters but I am utilizing a state machine setup. 

 

Thanks in advance

Download All
0 Kudos
Message 1 of 3
(2,401 Views)

That's because the initial state of the filter is zero, then it takes time for the actual samples in the waveform to "filter" in and elevate the output to match.  There are some techniques to work around this.  One would be to take the first few seconds of the waveform and append it to the front of your waveform, filter it, than cut off the first few seconds of the results.

Message 2 of 3
(2,389 Views)
Solution
Accepted by topic author LC3

I usually do this in all my programs to make sure that doesn't happen. Removes the offset that produces the spike and then adds it back afterwards.  If you are doing something other than a lowpass filter, don't add it back in.

 

Filter.png

Randall Pursley
Message 3 of 3
(2,381 Views)