Mean of vector with values < 1 returns as 1?

4 visualizaciones (últimos 30 días)
Sokratis Panagiotidis
Sokratis Panagiotidis el 24 de Jun. de 2022
Editada: Sokratis Panagiotidis el 28 de Jun. de 2022
Hi everybody,
What I'm dealing with is a vector with a massive amount of values (we're talking up to 20.000 entries). I am trying to find a certain pattern and wanted to try one solution by using the vector's mean.
Now you have to think of the vector as one that has high values for the first 1.000 indexes (y is betweeen 3 and 200), while the rest up to the end is something between 0,2 and 0,4 with occasionnaly having a jump up to 1,2. But that happens only like 3 to 4 times during the entire vector's length.
Now when I want to get the mean of the entrie vector, it gives me something of 0,9961 or something in that direction, which seems fair. I mean I have high values in the beginning and then they're pretty low for the rest. But when I try to get the mean of the vector WITHOUT the high beginning (meaning I take it from 1.001:end) I get a mean of 1.
Not only can that not be true, because it should be lower than the mean of the entrie vector, but it can't be excatly 1 without any decimal digits. Something along the lines of 1.0024 would actually make more sense. I tried to reduce and alter the area of the vector and determine their mean but it's always exactly 1.
How can this be and is there a way to get the actual mean of the part without the high values? I'd hate to have to use Excel or any other programm for that so I'd appreciate it.
Thanks in advace!
  7 comentarios
dpb
dpb el 24 de Jun. de 2022
"Long ago, when I first started doing consulting for mathematics and statistics, I recall taking some data I was provided. I got an entirely wonderful result, pretty much exactly what I would have wanted to see. But I was never able to reproduce what I had gotten. Never able to some way, even on exactly the same data, the magic never worked. (I spent a few days trying to figure out what I did. ..."
Oh, John -- that story brings back memories!!! I did something very similar years ago with some experimental test data collected at a power plant that I processed and presented to a client...I came down w/ a terrible case of something right after finishing up the test but couldn't postpone the meeting. I spent almost a month trying to recreate those results and never did get there; fortunately still had the original data and the final results, while not identical to what I had presented, at least did show the needed results.
To this day, I also have no idea what I possibly could have done originally...I was using MATLAB (mostly) with some Fortran mex...
Sokratis Panagiotidis
Sokratis Panagiotidis el 28 de Jun. de 2022
Editada: Sokratis Panagiotidis el 28 de Jun. de 2022
@DGM Hey the answer is quite simple and although I appreciate all the extra input from the others, I can say the issue was how I tried to get the mean.
What I did was:
mean(~isnan(movement.y))
instead of
mean(movement.y, 'omitnan')
The rest about the format wasn't the problem, as it would literally give me 1 instead of 1.0000 or how digits one has set.
I still apreciate the effort and the help.
Since I can't mark your answer as helpful could you write a seperate answer not directly written in the comment fields of my question @DGM? I can't mark it otherwise.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Calendar en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by