LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How many samples does a pt-by-pt filter need to start?

I'm using a 2nd order low pass butterworth filter on some real-time data. I've found a phase shift by plotting the data, but would like to know how many data points the algorithm needs before working.

 

 

Thanks

0 Kudos
Message 1 of 5
(3,398 Views)

Hello Graham

 

I am an Applications Engineer at National Instruments and I will be supporting you with this request. As I understand you are using the butterworth filter function with real time data and your query is How many data points does the function need before it can execute?

 

example.png

By altering the number of iterations. you can control the number of data points. I did some testing and found that you can bring the number of points very low and you will still get a result. I tried it with 2 iterations and data was still displayed.

 

If you would like any further information, please get in touch

 

Regards

Stephanie L
Applications Engineer
National Instruments UK and Ireland
0 Kudos
Message 2 of 5
(3,371 Views)

Hi Stephanie,

 

Thanks for that. I'm still not too sure what is actually going on. The attached filter works with only 1 data point, but only reaches sensible values after 5 or 6 iterations. 

 

My data is continuous on the whole, but occasionally disappears and reappears, so I need to make sure I understand what latency or phase shift is introduced by the filter (and other point by point functions).

 

I assume the functions are mainly used for RT applications, so I wonder why the help file doesn't mention anything.

 

 

 

Graham   

0 Kudos
Message 3 of 5
(3,361 Views)

Almost all filters introduce phase shift.  You can expect that the delay will mostly depend on the cutoff frequency.  If you have a LP filter with a cutoff of 1Hz then you can expect the filter to stabilize sometime after 1s.  The filter order will impact the ringing that you will see after the initial transient response.  You can always 'precharge' any filter by running it in a loop for n iterations where n=cutoff in Hz* sample rate in Hz.  You would want to increase n to encompass the transient (maybe double it).  Of course you still will have an in-line phase shift to consider if you are trying to correlate other data channels are use the filtered signal for real time control.

0 Kudos
Message 4 of 5
(3,350 Views)

Hello Graham

 

After doing some further testing with the function and opening up the function vi's to look at the code inside I have a few more ideas for your development.

 

The vi uses previous values to do the analysis, so although it is called point by point the analysis occurs using previous data as well. At the beginning of the analysis the previous reference is 0 so it takes time to ramp to the actual value.

 

I recommend that you create a case in your code that detects low readings. When you reach the low points, where your data is not being transferred you can choose to ignore a set of data to avoid the initial ramp, or you could preempt these values by forcing similar values to those that you read to 'initialise' the analysis and reduce the ramp effect.

 

If you choose to ignore the data or overwrite the erroneous readings I would suggest that the first 10 reading s should be ignored so that you avoid the ramp as much as possible.

 

If you have any further queries about this function, please let me know.

 

Good luck with your development

 

Regards

Stephanie L
Applications Engineer
National Instruments UK and Ireland
0 Kudos
Message 5 of 5
(3,332 Views)