LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Low pass filter losing information at edges of sample

Solved!
Go to solution

Hello,

 

I am using a 6th order elliptical low pass filter to remove signal trend from a blood pressure measurement from pre-sampled data, however since the program needs to process and calculate an indice in a particular time frame, I can not filter and then store the data for calculation later.

 

The sampe size is this 1250 or 10secs worth of data with the sampling rate is 125 samples/sec.

 

In the effort to remove distortion in the filtered signal I am using a described technique to add/tag a start and final ampitude value onto the begining and end of the sample of the same length (1250), I also run the data in reverse to remove phase effects.

 

However what I am getting is still some distortion that can be seen in the start of the sample; first one here with loss of amplitude, but more often it is worse than this and distortion occurs at the end from time to time.

 

filtered wave 2.JPG

 

filtered wave.JPG

 

I have some DSP experience (but from from 20 years ago!) and remembered windowing might be a way but I keep thinking that filter shouldnt be that hard to implement plus I dont want to lose any amplitude information.

 

Any help would be appreciated.

 

Cheers,

 

Kevyn

 

0 Kudos
Message 1 of 7
(5,689 Views)

Hi kevyn,

 

two notes:

- When attaching your VI you should set typical data as default so we can check the VI with…

- The "problem" looks like being related to the initalisation of the filters…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(5,686 Views)

Hi GerdW

 

1. Ah ok sorry about that for the data, I will wire it up next time. This is part of a much larger circuit and why I just cut a bit out.

 

2. Yes and now I see the init/cont part of the filter, I will investigate.

 

Thank you

0 Kudos
Message 3 of 7
(5,672 Views)

Kevyn,

 

All filters have a transient effect which occurs at the beginning of the data set. The duration of the transient depends on the type of filter, its order, and its bandwidth. 

 

Consider a physical filter composed of inductors and capacitors. When a signal is first applied to such a filter all the capacitors have zero stored charge and the inductors have zero flowig current. Until the charge and current values reach a steady state condition, the output of the filter will include the effects of the transition from all zeros to the new values. This is the transient. If the input signal changes suddenly, such as a jump to a different frequency or a change from a sine wave to a triangle wave, there will be a similar transient interval before the output waveform represents the new steady state value.

 

Filters are nice for some things. However, if you need to look at every data point including the first one, you may need to use different techniqoes which do not depend on stored information about earlier behavior of the signal.

 

Lynn

Message 4 of 7
(5,623 Views)
Solution
Accepted by kevyn5

@johnsold wrote:

..., you may need to use different techniqoes which do not depend on stored information about earlier behavior of the signal.

 

Lynn


In some special cases where the information that happened PRIOR to the data set you have available is implied but the data yo u do have, you can get away with reflecting the data set about the intial/final data point and then run the data through the filter first forward and then backwards. After doing that, toss the data that goes with your "pretend" data and just look at the part that iss associated with the actuall data set.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 7
(5,595 Views)

Thanks Lynn (and Ben),

 

Thank you for that detailed explanation, I can see now that my options are possibly to use only the "good data" (discarding the edges) within the dat set; it is acheivable because I am looking for variation for each breath, and a full breath (or a couple of full breaths) is seen within each 10 second window. 

 

I appreciate the information I can stop spending time on it.

 

Cheers,

 

Kevyn

0 Kudos
Message 6 of 7
(5,539 Views)

I ended up using extra datapoints the same length of the original "current" sample at the front and the back. I filtered this longer set of data points and then cut out the "current" and now filtered sample without any loss of fidelity.

 

Thanks all.

0 Kudos
Message 7 of 7
(5,490 Views)