04-18-2017 03:22 AM
Hello,
I have read in two csv excel spread sheets with frequencies and their corresponding amplitudes, created two separate 2d arrays and plotted these arrays as frequency v.s. amplitude graphs. Now I need to take these two 2d arrays and find the percent difference of amplitudes for like frequencies. I am looking for the best route to take here. This is my projected solution but other recommendations are more than welcome.
1) I need to iterate through one 2d array searching for the matching x value in the second array (finding like frequencies).
2) From here I assume I should create a third array and store the frequency and corresponding amplitudes to be further analyzed in step 3.
3) Then I need to subtract the frequencies corresponding amplitude (y1, y2 -values) values and multiply by 100 to find the percent difference.
4) Potentially create one last array with the frequency and corresponding percent difference.
5) Once the above two steps have been accomplished I need to display red, yellow, or green lights for each frequency depending on the value of the percent difference. 0 - 2.5 green, 2.6 - 5.5 yellow and 6.0 + red.
Any guidance on the most efficient method of accomplishing this would be greatly appreciated. I am fairly new to LabView but very familiar with Java in sorting and searching contexts so terminology and functional knowledge is not a problem but implementing it in this environment is proving to be a challenge.
Thank you.
Solved! Go to Solution.
04-18-2017 08:19 AM
You can do all of this in a single FOR loop. Just choose one array and make it the master. Autoindex on that array. The other array needs to just pass straight into the loop. Then you just search the current frequency in the second array. You get that index and use it to get the amplitude. So you now have both amplitudes at that frequency. Do the percent error calculation, make an array with the frequency and error and let that autoindex on the output.
04-25-2017 03:53 AM
I used your concept and ended up with this.
Thank you for the assistance.