From 08:00 PM CDT Friday, August 12 - 01:00 PM CDT Saturday, August 13, ni.com will be undergoing system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What am I doing wrong when trying to calculate peak to peak of my wave form that I am reading?

At the end of my rope on this one. No matter what I do the peak to peak is not close to what my physical meter is telling me I'm taking what's supposed to be the amplitude peak voltage of my signal, taking the average of 10 readings, then multiplying by 2. It's way off.

0 Kudos
Message 1 of 21
(1,301 Views)

I recommend to keep the subject short and place the bulk of the question in the body of the post.

 

We don't have any of your subVIs and we have no idea how the signal looks looks like. How does the signal look like and how do you use the "physical meter" (whatever that is ;)). A lot of your code makes little no sense.

Why is the ptbypt mean inside the case structure and why is the "sample length" wired to the iteration terminal thus changing with every call??? What was the thought process behind that???

 


@crash_override wrote:

I'm taking what's supposed to be the amplitude peak voltage of my signal, taking the average of 10 readings, then multiplying by 2. It's way off.


Why would the average of 10 voltage readings have anything to do with "peak to peak" (assuming time units). Do you have a link to a website that explain your logic?

0 Kudos
Message 2 of 21
(1,288 Views)

Upload an older version of your VI.  LV 2020 just came out a month ago.  Many of us have not upgraded yet.

 

Make sure you have the data you are working with saved as default in the VI either in a control or in a block diagram constant.

 

Tell us what the physical meter says you are getting for that data and what LabVIEW is giving you.

0 Kudos
Message 3 of 21
(1,286 Views)

@RavensFan wrote:

Upload an older version of your VI..


Here's a 2015 version. (No guarantees that it down-converted properly).

Message 4 of 21
(1,279 Views)

The reasoning for wiring the iteration terminal to the divisor is because I need the multiple of 10 to divide by to get an average. The reasoning for averaging is because my device (Analog Discovery 2) spits out such a ridiculous range that I found this is the only way to get consistent readings. Sorry, I didn't know how the vi file format worked. I thought it would include the code for the sub vi's too.

0 Kudos
Message 5 of 21
(1,166 Views)

My Physical meter (Extech 5mhz multiscope) is reading .84 p/p but my Analog Discovery 2 (with the averaging code) .30

0 Kudos
Message 6 of 21
(1,165 Views)

@crash_override wrote:

My Physical meter (Extech 5mhz multiscope) is reading .84 p/p but my Analog Discovery 2 (with the averaging code) .30


Numbers without specifying the units are meaningless. What are the units?

 

As we have already pointed out, your LabVIEW code is highly flawed. The sample length for the ptbypt mean should be 10, not [i] and it should not be inside a case, else you are only averaging every 10th value, giving you the average of 10 out of every 100 points. It is still not obvious what your signal is and how it relates to p-p of anything. Shouldn't you average the frequency instead of the amplitude??? And why do you delay it by one iteration? This was just a crazy mess! Did you correct all the problem? Can you show us the final code?

0 Kudos
Message 7 of 21
(1,125 Views)

I cleaned it up a bit and removed the ptybyte function. I don't understand how to average. The value just increases every time with this method. Is there a way to populate an array with 10 values divide by 10 and use that value and then clear the array for the next 10 samples?

0 Kudos
Message 8 of 21
(1,097 Views)

Just use the ptbypt mean (length=10) wired directly to your value and it will give you the average of the last 10 points. No need to increment anything in a shift register. no need for case structures (If you only want to update the indicator every 10 iteration, only the indicator should be inside a case structure). No other math needed (reading [i], dividing, summing etc.). Still, you are only averaging amplitudes which have nothing to do with any p-p period measurement.

0 Kudos
Message 9 of 21
(1,092 Views)

Thanks very much for the quick response! I will switch back to that ptp function. So you are saying the amplitude given from tone measurements will not be the peak voltage from my instrument's data? I was multiplying by two because I thought it was peak voltage so peak voltage multiplied by two equals ptp. If that's not the case then what can I use to compute peak to peak from that wave form coming out of the MSORead block? 

0 Kudos
Message 10 of 21
(1,088 Views)