From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem on filter design by using Signal Processing Toolset

Hi all,

I'm now designing a filter with particular shape by using NI Digital Filter Design provided in Signal Processing Toolset. I use the Arbitrary FIR Filter Dsesign with my frequency response data file to build the filter and use it in LabVIEW. However, when I put the filtered signal to calculate THD by using Harmonic Distortion Analyzer.vi, the result was larger that the correct value. I found that when I increase the filter order, the actual frequency response become the desired response but the THD result is also increased. I tried to use 500 as the filter order and each harmonic level was quite simular to the correct level, but the THD value was wrong. Are there any suggestions?

Bill
0 Kudos
Message 1 of 8
(2,785 Views)
There are many things that could cause the behavior you see.
Is your filter settled before your perform your THD measurement?
If each harmonic component seems correct but the THD too high, it could be because your fundamental tone is attenuated more than expected?

Can you be more specific and explain your concerns in more details? What is your measured THD and what would you like it to be and why? How do you know it should be that value? Eventually if you could post your VIs with input data saved at default that would be helpful.
Message 2 of 8
(2,785 Views)
Attached is the VI to describe my problem. Actually I'm writing a program to provide the same function of HP8903 Audio Analyzer and my program results are compared with it. I'm using PXI4461 with LabVIEW7.1 and WinXP.
0 Kudos
Message 3 of 8
(2,785 Views)
If you look at your signal, you can clearly see that it is not settled correctly. The filter needs some time to achieve its stationary state and the time needed depends on (and is equal to) the filter order (when you are using an FIR filter). I have modified your VI to extract a subset of your signal and you can see that all the resulting THD and THD + noise values are now almost identical.

The modified VI is attached.
0 Kudos
Message 4 of 8
(2,785 Views)
Thanks so much for solving my problem. I'd like to ask a few questions about FIR filter. What's the relationship of settling time and filter order? Are there any drawback of large number of filter order? Why the signal t0 is needed to reset?

Bill
0 Kudos
Message 5 of 8
(2,785 Views)
An FIR filtering operation is simply performed by convolving the signal with the impulse response of the FIR filter. The settling time is therefore exactly the length of that impulse response. In your case order = 500 means that the impulse response is 500 * 25us = 12.5ms. The higher the order the "better" a filter (that is steeper or bigger attenuation) but the cost is a longer settling time.

You could consider using an IIR filter instead since the phase linearity achieved with an FIR filter are (usually) not needed for distortion measurements. You can achieve similar filtering characteristics with a significantly shorter settling time than when using an FIR filter.

Since the THD measurement does not use timestamp informat
ion for anything I simply reset the timestamp to zero to simplify the following subset extraction. To be totally correct you can re-insert the corrected timestamp into you waveform.
0 Kudos
Message 6 of 8
(2,785 Views)
How's the 25us comes from? I'm using Arbitrary FIR Filter Design in signal processing toolkit. Are there any tool to use IIR filter with data file to disign filter? Thanks.
0 Kudos
Message 7 of 8
(2,785 Views)
The 25 us comes from the dt value of your waveforms, so I assume you are sampling your signals at 1/25 us = 40 kHz, right?

btw. I see that you have 3 filter options in your VI and that your default order is 1500, so for that one you should start your subset 1500 * 25 us = 37.5 ms after the beginning of your record.

As for arbitrary IIR filter, the task is not trivial in general, but if your response is relatively simple you can get away by playing with poles and zeros positions, but if you feel going on too deep water just stay with FIR. They seem to work for you.
0 Kudos
Message 8 of 8
(2,785 Views)