06-12-2012 12:25 PM
I'm banging my head against a wall with this one. I'm getting a spike at the start of my filter. I've captured data and stored it in a TDMS file for processing later. When I run my Filter VI it spikes at the start of every loop. Every time I use the filter there is a spike from ground to the raw data values at the very begining. It can't be a ground loop because I'm not taking any readings as it is post processing. I've attached everything I can think of.
It's got to be something simple that I'm not enabling but I can't think of it.
Any help would be really apreciated.
06-13-2012 04:07 AM - edited 06-13-2012 04:10 AM
What you see is a filter artifact that is caused by the initialisation of the filter internal memory (to zero).
See it as a additional filter step response
You are using a IIR filter so the artifact could be longer (in samples) than the filter order. (The step response (integral of the impuls response) time define the length of your artifact, depend on your filter coefficents and could be of any length, thats what the name IIR = infinitive impuls response say )
How to fight that artifact?
If you continously filter one signal (read n samples filter, read the next chunk , filter gain) the internal memory can keep that data so you will have it only once at the beginning. (No new init for every loop , see help of the filter vi)
If you want to get rid of the start artifact you can:
- capture more data and cut the artifact (only clean way)
- add some dummy data and cut that after filtering ..
the dummy data should have the length of your artifact and could be :
a DC value array of the fist real datapoint (coarsly the same as filling the internal memory with the starting point)
a mirrored portion of your data
However there will still be (smaller) artifacts left in your data
If you switch to FIR filter designs the length of the artifact only depends on the filter order.
06-19-2012 08:33 AM
When I originally wrote this VI, I somehow had no artefact output but somewhere in the iterative updates it appeared. It's a mystery to me. Your explanation makes perfect sense but I don't know what I changed that made it appear. I thought there might have been a boolean somewhere that I might have changed.