cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

ERROR WORKING OUT MEAN

ppal
17-Peridot

ERROR WORKING OUT MEAN

Hi

I have attached 2 x CSV files and Mathcad Prime.

 

I have isues on Page 5 of 9 calculation mean and SD

Thanks.

ACCEPTED SOLUTION

Accepted Solutions
StuartBruff
23-Emerald III
(To:ppal)


@ppal wrote:
Hi

Thanks for your reply. If you notice you will see that your
average calculation is off by a approx factor of 2.
This is due to the fact that there are "unncessary?" zeros in the column
of my data. Don't know how to remove them.


I've just had another look at your worksheet.  The easiest way to get rid of those extra zeros is to not have them in the first place.  You need a sampling method that contiguously allocates samples to a vector (I have a penchant for stating the blindingly obvious! 😊).

 

2021 12 17 c.png

 

As I've only got Express 7, I've had to resort to some messy (functionally-programmed) function definitions.  It would be a lot simpler with programming,

 

Preliminaries to make manipulating vectors easier.

 

2021 12 17 d.png

Then the dropnth and takenth function variants.

 

2021 12 17 e.png

 

And their use in either fixing the already sampled data or returning just the required samples.

 

2021 12 17 f.png

 

Stuart

 

 

 

View solution in original post

4 REPLIES 4
StuartBruff
23-Emerald III
(To:ppal)


@ppal wrote:

Hi

I have attached 2 x CSV files and Mathcad Prime.

 

I have isues on Page 5 of 9 calculation mean and SD

Thanks.


I've only got Prime Express 7, so had to define a few workarounds to get the result I think you intended.

 

Loc would appear to be a vector, LL a scalar, and iL a range variable.   mean and stdev only have a meaning in the context of multiple values of numbers, ie vectors or matrices not scalars.   So, I'm guessing that you mean(!) to get the mean and stdev of Loc as a whole.   

 

The expressions as written appear to be using iL to try to calculate the mean & stdev of each value of Loc.    Furthermore, a range variable should appear on both sides of a definition, whereas you've only got it on the rhs of sigma's definition.

 

I've defined mu and sigma to return what I think you want ... at least they display something!

 

2021 12 17 a.png

 

Stuart

ppal
17-Peridot
(To:StuartBruff)

Hi

Thanks for your reply. If you notice you will see that your
average calculation is off by a approx factor of 2.
This is due to the fact that there are "unncessary?" zeros in the column
of my data. Don't know how to remove them.

Regards
ppal
StuartBruff
23-Emerald III
(To:ppal)


@ppal wrote:
Hi

Thanks for your reply. If you notice you will see that your
average calculation is off by a approx factor of 2.
This is due to the fact that there are "unncessary?" zeros in the column
of my data. Don't know how to remove them.

Regards
ppal

It's way past my bedtime and I'm afraid looking at data is beyond my current cognitive state's capabilities.  😴

 

However, the fix is straightforward, once one realizes that the rhs index needs to increment by double the lhs index.  🙂

 

2021 12 17 b.png

 

Stuart

StuartBruff
23-Emerald III
(To:ppal)


@ppal wrote:
Hi

Thanks for your reply. If you notice you will see that your
average calculation is off by a approx factor of 2.
This is due to the fact that there are "unncessary?" zeros in the column
of my data. Don't know how to remove them.


I've just had another look at your worksheet.  The easiest way to get rid of those extra zeros is to not have them in the first place.  You need a sampling method that contiguously allocates samples to a vector (I have a penchant for stating the blindingly obvious! 😊).

 

2021 12 17 c.png

 

As I've only got Express 7, I've had to resort to some messy (functionally-programmed) function definitions.  It would be a lot simpler with programming,

 

Preliminaries to make manipulating vectors easier.

 

2021 12 17 d.png

Then the dropnth and takenth function variants.

 

2021 12 17 e.png

 

And their use in either fixing the already sampled data or returning just the required samples.

 

2021 12 17 f.png

 

Stuart

 

 

 

Announcements

Top Tags