LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"Amplitude and Levels 1 chan.vi" producing erroneous result

We are using the Amplitude and Levels 1 chan.vi function in Auto mode, which means it's probably using the histogram method.  Feeding in an 800 point sinusoidal signal that's pretty solid.

Getting a poor output from it.  Attached is an image with two qualitatively identical sampled waveforms.  The same algorithm calculates 3K for one, but only 2.2K for the other.  Depending on how much of it and what phase it's in, it vacillates between the right and wrong levels.  I suspect this has something to do with the sampling frequency, etc.

 

However, when we use the Peak method, it's just returning the high-low samples, and one noisy point can mess it up.

 

Any ideas here?  I tried the Amplitude Level And Measurements Express VI, and this seems to work asking for Peak-to-Peak, but why does that work and the other fail?  Should I be running this through a filter first?

 

Any ideas are welcome.

 

Jed_Davidow_0-1627340013160.png

 

0 Kudos
Message 1 of 9
(202 Views)

Hi Jed,

 


@Jed_Davidow wrote:

Getting a poor output from it.  Attached is an image with two qualitatively identical sampled waveforms.  The same algorithm calculates 3K for one, but only 2.2K for the other.  Depending on how much of it and what phase it's in, it vacillates between the right and wrong levels.  I suspect this has something to do with the sampling frequency, etc.

 

Any ideas are welcome.


Idea: attach your VI when you want help on that sepcific VI. We cannot tell much from looking at an image of a frontpanel…

Best regards,
GerdW


using LV2020 on Win8.1+cRIO
0 Kudos
Message 2 of 9
(179 Views)

There's nothing going on. 

 

It's literally the data you see fed into the function (separately, it only operates on one array at a time) and those are the results.

 

If someone knows why the histogram algorithm does that and can help, great. But otherwise it's clearly a consequence of sample rate and phase; I just don't know how to eliminate it. 

0 Kudos
Message 3 of 9
(177 Views)

Hi Jed,

 


@Jed_Davidow wrote:

There's nothing going on. 

It's literally the data you see fed into the function (separately, it only operates on one array at a time) and those are the results.


How do you feed the data into that function? Is that a chart or a graph?

 

When you were asked to supply an example VI you should do so. We still cannot debug/edit/run images with LabVIEW!

 


@Jed_Davidow wrote:

If someone knows why the histogram algorithm does that and can help, great. But otherwise it's clearly a consequence of sample rate and phase; I just don't know how to eliminate it. 


With an attached VI we could see what that function does and which data it receives.

"But otherwise" you decided not to attach a VI…

Best regards,
GerdW


using LV2020 on Win8.1+cRIO
0 Kudos
Message 4 of 9
(158 Views)

Snippet Attached

 

amplitude.png

0 Kudos
Message 5 of 9
(145 Views)

Hi Jed,

 

thanks for providing the snippet!

 

Sometimes the default parameters don't fit to your specific problem - and you just need to change them a little bit:

I changed the histogram size…

Best regards,
GerdW


using LV2020 on Win8.1+cRIO
0 Kudos
Message 6 of 9
(142 Views)

There are plenty of histogram sizes that work on THAT particular set of data, here is an analysis of the histogram size selection on both waveforms...

Considering I may have a random sized/sampled waveform run through this code, how can I be sure it won't fall into the wrong region?  Is there a more stable function?

 

The reason I am even asking this here is because someone else originally coded this and validated it, and it ran without issue for almost 9 months before we started seeing bad results.  But the results weren't bad, it was just that the waveforms changed imperceptivity and the output changed wildly.

 

Jed_Davidow_1-1627394929659.png

 

0 Kudos
Message 7 of 9
(137 Views)

Heres a good example... take the same data and delete off a few points from the start of the waveform. Here's what happens if you delete off just 18 points from the start of it, then test it against 1->256 for the histogram setting:

 

Jed_Davidow_0-1627395907467.png

 

0 Kudos
Message 8 of 9
(134 Views)

Hi jed,

 

that's the problem of a histogram based analysis: by setting a fixed amount of bins you may encounter the problems you are seeing because your signal data has some noise added!

Depending on the amount of noise some bins might get more/less/no samples and will disturb the amplitude calculation.

 

When your signal has some noise, but you receive several periods of the signal as it seems from your example data, you might calculate the amplitude from determining (averaged) peak values on your own. Or use a different method than "histogram"…

Best regards,
GerdW


using LV2020 on Win8.1+cRIO
0 Kudos
Message 9 of 9
(126 Views)