06-30-2017 06:26 PM
Hello community this is my first post! Have been reading the forums for some time now trying to figure out my way around the software. Have learned a lot over the last few months but i still have a lot more i want to learn.
I'm creating an application in Labview 2013 that can detect the cutoff frequency of a Low or High Pass Filter. I have two data points that are being indexed onto the frame of a for-loop over a user chosen number of iterations. These data points describe the dB gain vs frequency as an AC sweep is performed through either a Low or High Pass Filter. I'm trying to use linear interpolation to determine what the cutoff frequency is (assuming it will be at about -3dB no matter what range i sweep), but am having no luck. I've tried bundling creating arrays. indexing the individual streams with no luck. I find that my skills with arrays and clusters are sub-par and i feel that is the source of my struggles.Here is a screen shot of the back end of my application. Any information would be much appreciated.
Solved! Go to Solution.
07-01-2017 07:18 AM
Hi RJ,
when you are looking for a certain X value corresponding to a known Y value you should use the function Threshold1DArray.
Interpolate1DArray gives an Y value for a known X value…
Btw. most of the time it's much better to provide a real VI with some embedded default data then just to present an image!
07-01-2017 07:29 AM
@GerdW wrote:
when you are looking for a certain X value corresponding to a known Y value you should use the function Threshold1DArray.
But do note that the Threshold 1D Array is expecting a constantly rising waveform. So you may need to reverse the array to get the value you want.
07-01-2017 12:27 PM - edited 07-01-2017 12:34 PM
Thank you, I will test out your solution. I just want to be clear that since the user is choosing the number of points to plot (iterations) there is little chance that -3dB and the associated frequency will be in the data set. That i why i was looking to linear interpolation to find the solution. I assume it will take the two points and frequencies directly adjacent to the dB value i am looking for and estimate what that frequency valued might be.
07-01-2017 01:35 PM
@crossrulz wrote:
Threshold 1D Array is expecting a constantly rising waveform.
The right term is "non-descending" which is slightly different. 😄 But yes, that function will work fine once you negate the array and threshold. You should form your upper input into an array of points so you get the x in the right magnitude.
Also note that your x-axis is logarithmic, so your might need to tweak depending if you want a linear interpolation on a linear or logarithmic scale. You can easily account for that if needed.
07-01-2017 01:46 PM
GerdW after reading your comment again i understand what you meant by suggesting the Threshold 1D Array. It works very well for the High Pass Filter, right within my 5% error margin (likely do to round off error in formula node).
Crossrulz you are correct in it not working for descending plots, like a Low Pass filter. I have found the function reverse array that may get me where i need to be.
It will have to work with either circuit so i must come up with a way for it to determine that. I'm thinking of using a case structure with the conditions of first Y < Second Y. That should let me know what circuit i am dealing with and i can execute depending on that situation.
Do you know of a functions that will allow me to compare the first and second elements of a 1D array?
07-01-2017 03:36 PM
@RJMason wrote:
Do you know of a functions that will allow me to compare the first and second elements of a 1D array?
"Index array" resized to two outputs will get you the first two elements. Have you found the comparison palette?
07-01-2017 03:47 PM
Yes i have. I realized what i had was a 1D array of 2 cluster elements. I played around with combinations of Split 1D array, Index Array and UnBundle by Name and found that if i just index the dB gain into the edge of the For Loop and bypass the 1D array cluster all together i can just index elements one and two and compare them pretty easy. I'll test a few more configurations to make sure all is well.
07-03-2017 09:09 AM - edited 07-03-2017 09:10 AM
I was unclear what you meant at first with "negate the array". I see now that its throws the the Min Max off, swapping them basically. I fixed this by just swapping the indicators as i was not sure how to negate the entire array. All seems to be working fine now. Thanks!
07-03-2017 09:44 AM - edited 07-03-2017 09:45 AM
@RJMason wrote:
I was unclear what you meant at first with "negate the array". I see now that its throws the the Min Max off, swapping them basically. I fixed this by just swapping the indicators as i was not sure how to negate the entire array. All seems to be working fine now. Thanks!
A simple array can be negated at once and if you have an array of clusters, you can just multiply with a suitable scalar element.

I have no idea why you are bringing "indicators" into the discussion. These operations are just for the interpolation math, don't need to be displayed, and thus don't involve indicators.
Can you show us your final code?