05-20-2010 03:15 PM
I'm using a cascade filter with butterworth coefficients in the attached vi. There are some values for input I can give the filter such that it causes the output to be an array of NaN. This is fine, except that when I give the filter the exact input that has already yielded a good result, it still outputs NaN. If I change the boolean input init/cont to false, run it once, then change it to true, the filter works fine. Is the data somehow getting left over in the filter? Or is there something I can do to stop this from happening? Thanks.
John
Solved! Go to Solution.
05-21-2010 04:57 PM
Hi John,
If you look at the VI, there is an uninitialized shift register. Essentially between runs, this shift register holds the previous values it contained, which would explain why you still see the NaN values. What you'll need to do is set the Init/Cont constant to true to clear out that shift register.
05-24-2010 10:10 AM
Thanks Kyle. Unfortunately, as you can see in my attached vi, I already have that constant set to true. The only way this problem disappears is if I set it to false, run the vi once, then set it to true again. So from my perspective, the init/cont option does not work. Any other ideas? Thanks.
John
05-24-2010 10:18 AM
Hi John,
Turns out I also need to read the LabVIEW Help better. If you look at (http://zone.ni.com/reference/en-XX/help/371361F-01/lvanls/iir_cascade_filter/), this constant works opposite than what we want. Essentially, it initializes the VI when set to false and uses previous data when set to true. What you can do in your VI to make sure each run starts with fresh data is to use the First Call? function and invert it. When the First Call? is called at the beginning of execution, it outputs True; False is output for all other iterations. If we invert this, you get False (Initialize in this case) on the first iteration of the Cascade filter and True for every other call of the VI.