11-25-2015 08:19 AM
Hello All,
I was hoping someone can point me inthe right direction, as I have been searching the threads and banging my head against the wall.
I want to filter data, but eliminate the phase. Data is simple accelerometer data which will be stored in an Array for post processing. So it is NOT real time (doing zero phase on real time is not possible, because we would need to look into the future). I am looking to use this:
http://zone.ni.com/reference/en-XX/help/372636F-01/mstudiowebhelp/html/92d15f99/
and also if we look at the IirFilterBase class, there is the above zerophaseFiltering method that we can use:
http://zone.ni.com/reference/en-XX/help/372636F-01/mstudiowebhelp/html/bbfa383/
Where I struggle, is how to write the code to call the class and the method in C#. I have followed the example code for say a more traditional filter (like butterworth etc), and I am sucessfully using those.....so not new to C# or programming at all....
Would anyone have an example or point me in the right direction on how I can use these functions?
Is "IirFilterBase" common to all other filters, and we simply need to pass the right parameters to have the filtering done with Zero Phase? In MATLAB, there is a simple function "filtfilt" to have this done, but for the life of me, I can't figure out how to have my data filtered, but eliminate any phase angles in it with measurement Studio. I am using MS 2012.
Thank you in advance for any guidance and help!! Trully appreciate it!
Solved! Go to Solution.
11-25-2015 02:36 PM
What code have you written so far?
It looks like you call the function and pass in three arrays of doubles essentially floating point numbers --- the input Data, the reverseCoefficients, and the forwardCoefficients
11-25-2015 03:35 PM - edited 11-25-2015 03:43 PM
Thank you VERY much for your reply!!!
....Yes, After looking at it some more, I figured that this method is in fact a static member,
and as such I can call it with a function....something like this:
double some_array = IirFilterBase.ZeroPhaseFiltering(inputdata, forwardcoefficients, reversecoefficients) ;
The input data is straight forward, that is the data I want to filter. However, where do I get the Forward and Reverse coefficient? Do I have to first
use another filter like a Butterworth to get this?
The examples and texts I have read, are not very clear what the forward and reverse coefficients are....Can you point me in the right direction?
Are the forwardcoefficients the filtered data in forward time, and the reverse, the filtered data in reverse?
11-25-2015 07:13 PM
Sorry. I haven't worked with filters too much, so I can't help you with the math of it.
11-26-2015 10:31 AM
Thanks again...
Can someone, or an admin/developer respond, as to what the forward and reverse coefficients are, and how can they be obtained? They need
to be passed to the function as an array of type double, but what are these values, and how can they be derived?
Appreciate the help!
11-30-2015 04:28 PM
Cyborg,
The forward and reverse coefficients of an IIR filter characterize the mathematical transformation between input and output signal; they correlate to physical pieces of hardware that can be implemented to characterize the circuit. When you pass the function a set of coefficients you are effectively building the filter in software. The math behind IIR filter coefficients isn't specific to NI; wikipedia has a great overview of IIR found here: https://en.wikipedia.org/wiki/Infinite_impulse_response
In short: there's not really a list of coefficients I can give you. There's some design work that needs to be done on the developer side in order to determine what coefficients to use.
11-30-2015 04:43 PM
Thank you for your response!
I guess I will not be able to use this then. I will try taking a more traditional approach as described here:
http://www.dspguide.com/ch19/4.htm
Will filter in the forward direction, then in the reverse, and then combine the result. I can easily implement that with say a butterworth IIR filter, and since my data is stored (not real time), should be straight forward to implement.
Will have to test that out...
THank you again for your time...appreciate it!