Skip to main content
17-Peridot
August 25, 2010
Question

Mean of array problem

  • August 25, 2010
  • 4 replies
  • 8111 views

Hello folks,

I'm facing a frustrating problem as, to me, my approach appears straight forward and therefore watertight. It is as follows:

  1. I've got some measurement data from which I'd like to exclude the initial measurement points as they merely show the start up of a process and I'm interested in the established process (the velocity of air in a wind tunnel in my case)
  2. I extract a subset of measurement points by giving a start and stop value for the data.
  3. A range variable is defined by these start and stop values. This way I'm able to control the extraction and the visualisation in a XY plot.
  4. I calculate the mean of this subset.
  5. An array is defined that contains in each element the mean value. This is done to visualise the mean in relation to the data points
  6. Both sets are displayed in a XY plot with i as tzhe range variable

As apparent in the attached file, the range doesn't work for both. One array display (VA) appears to stop at the index of its own array (at 100) instead at the index as defined by i (145). Moreover, the average is biased.

Weird!?

The way I see it, the subset VA and the average array mVA should start and stop at the same index. Perhaps this is the culprit. Does anybody have an idea?

Thanks in advance for any help

Raiko

4 replies

1-Visitor
August 25, 2010

Several things are happening here.

first off, your variable mVA doesn't need to be an array--the mean of an array is a single number. Mathcad is perfectly happy plotting a single number against a range variable. (Try it!)

Second, the reason your mean value seems skewed is because there are a large number of values clustered at the low end. (histogram is a great function for seeing the way data is distributed. Researching this problem led me to discover another problem:

you define x0 and x1 as the trim points for your data--that's a good idea, it lets you change your trims without risking altering the submatrix function call. But when you get below the submatrix function VA is an array that starts at index 0. So when you plot VA[i against i, you're discarding the front 46 points of VA.

I plotted Y<0> against Y<1> (second column against first). Your data shifts at about index 85. When I made x0 = 85, the mean value got healthy, but the circles dissappeared from the plot. Why? Because VA is now 145-85 = 60 elements long, so VA[85 doesn't exist.

I've done some mods, made some notes. Good Luck!

Raiko17-PeridotAuthor
17-Peridot
August 25, 2010

Thank you Fred!

one problem is that each array starts at ist own index, which I managed to overecome by using my start and stop values on the diagram so that the measurement data and the mean begin at the same point.

And thank you for your helpful hints as well!

Raiko

1-Visitor
August 25, 2010

You could use the "Subvector function" to extract your data.

See attached image.

Mike

19-Tanzanite
August 25, 2010

Your problem occurs because array indicies always start at the value of ORIGIN, which by default is 0. That is true regardless of whether or not you specifically assign values to all the elements when you create the array, or whether the array was created from a larger array using submatrix.

1-Visitor
August 25, 2010

...

MCADunk_4.gif

...

Raiko17-PeridotAuthor
17-Peridot
August 26, 2010

Hello Jean,

for the life of me - I don't get it. I haven't changed anything, simply shut off my computer over night and this morning: Hogwarts!

Yesterday, there was an offset which I couldn't fix. However, this morning, upon opening the MC document everything was as it should be. Both point series (data and averages) started at the same point. Is this a MC glitch or some windows bug?

Anyway, folks. Thank you for your time

Raiko

1-Visitor
August 26, 2010

Raiko,

My interpretation was that you wanted to plot the mean all along the X at every of the indices. That's only how to plot it. Thus you will have the data around the mean as an artificial Cartesian X. You can have it as a continuous line or points. The bar plot is supplementary and superfluous information.

Jean