08-19-2019 03:22 AM
Hi All,
I am a new Labview user and having issues in finding the exact location of the peaks. I tried modifying the example of peak detection vi as per my requirement but couldn't figure out two issues,
1) the x-axis of the plot should be 900 to 1300 but showing 0 to 400.
2) Giving the wrong peak locations.
Your help will be greatly appreciated.
Solved! Go to Solution.
08-19-2019 03:53 AM
Hi Hassan,
1) the x-axis of the plot should be 900 to 1300 but showing 0 to 400.
You are creating a new x axis, starting from zero: so why do you wonder about this behaviour?
2) Giving the wrong peak locations.
It is giving the correct peak locations as described in the LabVIEW help: as sample index in the sample array!
You need to convert those indices back to your x locations using the x axis from your CSV file!
08-19-2019 05:37 AM
Hi,
1) I got your point. The for loop shouldn't be there.
2) What is the formula to convert sample indices back to x location.
Thank you.
08-19-2019 05:46 AM
Hi Hassan,
2) What is the formula to convert sample indices back to x location.
You can use options:
08-19-2019 08:07 AM
maybe similar problem solved here
08-20-2019 04:28 AM
Hi GerdW,
I am still struggling to get the right peak locations. I understand what you meant but unfortunately couldn't do it in Labview. Can you please add these bits "
to get the desired peak locations?
Regards
Hassan
08-20-2019 04:52 AM
08-20-2019 04:57 AM
You have the "Locations" values as an array of DBLs.
Copying from the already mentioned help:
Locations contains the index locations of all peaks or valleys detected in the current block of data. Because the peak detection algorithm uses a quadratic fit to find the peaks, it actually interpolates between the data points. Therefore, the indexes are not integers. In other words, the peaks found are not necessarily actual points in the input data but may be at fractions of an index and at amplitudes not found in the input array. |
If you want to get the value of the X array given an X index, you can either
Note that for both of these solutions, you'll probably need to provide a For loop to go through your list of locations. Take care not to allow indexing of the X array at the input tunnel.
08-20-2019 06:14 AM
Hi GerdW.
Thank you so much for doing it.
I wasn't disabling the index of the For loop.
Regards
Hassan
08-20-2019 06:18 AM
Hi,
I was making the mistake you mentioned at the very end of your comment. Thank you very much for your detailed help.
Regards
Hassan