11-26-2009 03:15 AM
Hi,
Can anyone help, I'm having writers block!
I have created a VI to create limit lines for a test. The VI creates a MIN and MAX limit by a the user entering a frequency, minimum and maximum limit using a table. The example I have is:
Frequency Min Max
2MHz 0 -10
3MHz 0 -10
3MHz 0 -12
4MHz 0 -12
This creates a limit line on my XY graph.
When the test has been performed I want the result to be checked to the limits stored. So far I have displayed both result and limit line on the XY graph, but I am having difficulty in checking the result as the results array is different. The example results I have are:
Frequency result
1MHz -9
1.5MHz -11
2MHz -12
2.5MHz -11
3MHz -12
3.5MHz -13
4MHz -13
So to check the result visually I would skip the first 2 frequencies and check the others. Is there a simple way of interpolating the arrays to compare or will I have to loop round the test frequencies checking whether to check the limit or not. One idea I had was to calculate the test frequency increment, and then re-created the limit line array to match the result array.
Any help would be appreciated!
Solved! Go to Solution.
12-01-2009 03:53 AM
Hi Marty,
There is an interpolate 1D array function in the array palette that should allow you to read out the y-values of an array based on the x-value. As the x-values are set programmatically, you can select which values you wish to read from based on what the user inputs, if you so wish.
Try using the Interpolate 1D array. If you are still having problems then post here again and I will be happy to help. If you like, I could take a look at your code to help you implement this feature.
Kind Regards,
Jas.W
12-02-2009 05:00 AM - edited 12-02-2009 05:02 AM
Hi Jason,
Yes I was using the interpolate function, but I was having trouble with the algorithm to know when to interpolate or not and if there were any special cases. I finally come up with a VI to do it now, and I have attached the code. Do you think there is any way to simplify the code more?
Regards
Martin
12-02-2009 08:49 AM
12-02-2009 09:39 AM - edited 12-02-2009 09:41 AM
Hi Jason,
I can't view your code. I am using version 8.6
Sorry about the test data. The original test and limit data I put on the forum was made up and was not very helpful when I was programming. I did change the data to the ones in the forum and came out with what I was expecting, but with a small error. So I my new limit data is:
Frequency Max
2.0 -10
2.5 -10
3.0 -10 (should be -12) as in this case I should have taken thelowest limit point.
3.5 -12
4.0 -12
The 3.0 frequency is incorrect. It should have taken the smallest value of -12. Other than that all should be correct as 3.5 is between 3 and 4 and the middle of -12 to -12 is -12.
You might be confused about the test data. I have not completed the VI yet to check the new interpolated limits with the test result. All I have done is created new limit data so it will compare with the test data. Hope this makes sense.
Thanks
Martin
12-02-2009 10:12 AM