Signal Conditioning

cancel
Showing results for 
Search instead for 
Did you mean: 

Filter Spike

Hi,

 

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.

 

Thank you,

 

Dan.

Donners
0 Kudos
Message 1 of 3
(5,407 Views)

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.

 

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


Message 2 of 3
(5,396 Views)

Thanks Henrick,

 

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.

 

Thanks,

 

Dan

Donners
0 Kudos
Message 3 of 3
(5,376 Views)