03-04-2019 05:17 AM
03-04-2019 06:33 AM
If you can measure the frequency over (say minimum) 5 periodes (better 10 or more) you should give the tone detection vi a try to measure frequency and amplitude 🙂
If you need a good result (less disturbed by noise) between each periode (or even less than a periode) you should make yourself familar with the correlation function.
hint : if you only measure one channel you can read the DAQ output as a single wfrm...
tone detection comes with different types and accept single wfrm and wfrm arrays
03-04-2019 07:38 AM
Thank you, GerdW for showing me the problem. Now I can see the red dots finally, it was because I forgot the input. But the data I have is like this, and I only need one peak, the highest in value. Any idea how can I fix this by ''playing'' with the peak detector?
Henrik_Volkers, I will try to use that VI.
03-04-2019 11:29 AM
In the help file to peak detection you can read how it works (fit a square function)
so if you increase the points width you are less sensitive to noise but if you fit too much points, you have a systematic error because you fit a square function to a sine shaped peak.
But works fine if you use about the top 5 % of the sine peak. How many points width that will be depends on you sine freq, and samplerate.
However if you know that you have a sine, the tone detection works much better.
For a single periode a (interative) 4 parameter sine fit (f,amp.,phase,offset) would be my choice.
03-05-2019 09:07 AM
Henrik,
I read the help file. It says that the value should be no more than about 1/2 of the half-width of the peak. How can I calculate the half width of the peak?
For example, I'm using a sine with frequency 5Hz and samplerate 16k. How can I get the value of my width?
03-05-2019 09:53 AM
May I ask how many years of math classes you alredy had?
one periode are 2pi or 360°
how many samples do you have per periode?
The help file tell you to take not more than half width of the pulse,
I recommended to only take the top 10% better 5% of the sine peak.
Do you remember the arcsin function?
Lets see, arcsin(0.95) results to ~71°, make it 70 .. remember sine? 90° it the top, so we want 2 * (90°-70°) = 40° of the 360° . How many samples will that be?
03-05-2019 10:42 AM
here is the systematic error you make with peak detection on a sine peak:
if you know you have sine use tone detection* or a sine fit
*) tone detection with at least 5 better more than 10 periodes
03-05-2019 10:53 AM
Just realized I took 0 as the starting point. The half peak width also could be seen as the zero crossings.. so half a periode 😄
... result into a 2% to low error 😉
BUT migth be not too bad if only the time/position is needed ....
03-05-2019 11:01 AM
Henrik,
I have had analisis classes during the two years of the university, we didn't do this arguments...
But thank you so much for your detailed example. I think I can get the peaks right for now! Can I ask you a last favor, to please attach the vi you used to show my error?
Thank you again for your patience!
03-06-2019 04:28 AM
Basic trigonometry should have been covered before you are allowed to enter university 😉
I was tempted to not post the vi to force you to learn basic math (and some LabVIEW) ... however
Here we go ....