08-21-2005 07:13 PM
08-22-2005 02:43 AM
I'm not sure you gave a sufficient information. Assuming that you just want to calculate a linear average of the data collected in consecutive runs, you have two simple methods :
1/ concatenate the data before calculating the mean.
Simple, but can occupy a huhe amount of space since all the data have to be stored in memory
2/ store only the means Mi and the corresponding number of data points ni and calculate a balanced mean : M = sum (ni x Mi) / sum (ni) )
The attached vi illustrate both methods.
08-23-2005 05:47 PM
Hi
Thanks for your help guys.
I will explain a bit more.
Lets say i have 4 runs with the corresponding sample sizes:78 (Run 1),73(Run 2),74(Run 3),55 (Run 4). These correspond to times of 3.9,3.65,3.7 and 2.75 seconds,
What I want to do is to calculate the average profile from these runs.
For the first 2.75 seconds, the average is calculated by (Run 1+ Run 2 + Run 3+ Run 4)/4
The next 0.9 seconds, the average is calculated by (Run 1 + Run 2 + Run 3)/3
The next 0.5 seconds, the average is calculated by (Run 1 + Run 2)/2
and
the next 0,2 seconds the aveage is calculated by (Run 1 /1)
Can you please help?
Thank you.
08-24-2005 12:46 AM
08-24-2005 05:38 PM
Hi
Thanks for that.
But when I ran your vi, it only produced 4 points. It should produce more points than 4 (e.g. 78 points).
Can you please help?
Thank you.
08-24-2005 06:57 PM
Hi again
I forgot to add this diagram.
08-25-2005 01:56 AM
OK, with a picture things are easier to understand. But, please, do not use bmps ! Prefer jpegs or even better pngs, to save space and download time.
The attached vi does the job. Not optimized for large data (change the external For loop for a while loop, and do the concatenation inside...), but I had not much time...
08-29-2005 06:34 PM
Hi
I made a modification to your vi (see attached). But when I run it I get the correct average but at the last point I get NaN (not an number).
I do n ot know what is going on.
Thank you.
08-30-2005 11:40 PM - edited 08-30-2005 11:40 PM
Message Edited by Philip C. on 08-30-2005 11:41 PM