07-21-2014 10:08 AM
I am reading https://decibel.ni.com/content/docs/DOC-5041
and since I only have access to LabVIEW 6.1, I am interested in the block diagram JPG.
Unfortunately, I am getting an error when I click on the JPG.
Can someone help me out by posting it?
Solved! Go to Solution.
07-21-2014 10:18 AM
07-21-2014 11:03 AM
Thank you.
07-21-2014 11:12 AM - edited 07-21-2014 11:57 AM
This seems like very clumsy code. For example if you later want to average more or fewer elements, you would basically need to rewrite the code from scratch. It is not scalable! Why would you need six diagam constants (DBL zero)? All you need is one and branch the wire. Why would you wire N of the FOR loop when autoindexing over the array? This is very crude beginner code that will only teach you bad habits. 😞
If you don't have access to the "ptbypt mean", you can make your own. Here is an old example (see lower part of code. The ptbypt version above it is just used to show that it gives the same result)
Try to implement it. To change the number of points to average, all you need to do is change a single integer. Since the mean does not care about the order of elements in the buffer, all you need is replace the oldest with the newest at each iteration, no need for rotating or shifting, etc.
07-21-2014 12:39 PM
I am not quite sure what to do when I have a finite set of data points; let's say 10.
If the numbers are 10,20,30,40,50,60,70,80,90,100.
I am adding 10,20,30,40,50 and taking the average.
Then I am adding 20,30,40,50,60 and taking the average.
and so forth.
When I reach the number 70 and want to take the average, I no longer have 5 numbers to average.
Am I approaching this correctly?
07-21-2014 01:08 PM - edited 07-21-2014 04:37 PM
If you only want results that contain the average of 10 values, your output array will be shorter accordingly.
My code starts averaging with the first element, so the first output would be the first input, the second output would be the average of the first and second input, etc. etc. and the last value would be the average of the last N point.
07-21-2014 01:23 PM
@altenbach wrote:
If you only want results that contain the average of 10 values, your ourput array will be shorter accordingly.
My code starts averaging with the first element, so the first output would be the first input, the second output would be the average of the first and second input, etc. etc. and the last value would be the average of the last N point.
Using the set of 10 values above, the 1st average would be just be 10. The 2nd average would be (10+20)/2. The 3rd average would be (10+20+30)/30.
Am I understanding you correctly?
07-21-2014 01:24 PM
Yes.