[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

a way of taking out very different value before calculating an average

Posted on 2006-03-24
12
Medium Priority
?
193 Views
Last Modified: 2010-03-31
i'm programming in j# which receives GPS data.

I noticed that sometimes the GPS give very 'bad' or 'wrong' data from time to time.

I designed a program that calculates something according to the data it receives

but since sometime i get some bad datas i decided to take the average data of every 3 datas

for example, if i'm using the bearing, i would get three bearings and get the average of the three and use them as the value.

but sometimes one of the three values would read very incorrect data.

i was wandering if there was an algorithm of some sort to take out that bad data or give less weight to it when doing the average.


ex.

bearing1 = 39
bearing2 = 43
bearing3 = 05

when i get this, i don't want to average the three but actually get soemthing in between 39 and 43

please help

cheers
0
Comment
Question by:shpark82
  • 3
  • 3
  • 3
  • +1
10 Comments
 
LVL 92

Expert Comment

by:objects
ID: 16285817
if you know the valid range you could check each values falls inside it and ignore any value outside.
0
 
LVL 1

Author Comment

by:shpark82
ID: 16285842
actually even the wrong values are always going to be in range between 0 to 360 but it is just that sometimes the reading is incorrect by quite a bit
0
 
LVL 92

Expert Comment

by:objects
ID: 16285855
you need to know what is correct or incorrect, do u have a way of determing that. eg. how would u do ity manually
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 1

Author Comment

by:shpark82
ID: 16285953
compare the three and see which of the three are completely different from others

for example if i had a sample of 10 readings

10,12,11,9,33,10,11,13,8,10

i would know that 33 is a bad read and therefore put much less weight on it when calculating the average of these

standard deviation or something? not sure
0
 
LVL 92

Accepted Solution

by:
objects earned 1000 total points
ID: 16285996
perhaps do two passes, first to take the average of all numbers
and the 2nd to strip out any numbers that are drastically outside that average
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 1000 total points
ID: 16286021
Take the median perhaps instead of the mean. (39 in your example)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16287033
>>
first to take the average of all numbers
and the 2nd to strip out any numbers that are drastically outside that average
>>

If you're going to do it that way, you need to do it the other way around
0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16287888
Are you using any standard J# GPS API?
0
 
LVL 1

Author Comment

by:shpark82
ID: 16288239
i'm using J# express

free version from microsoft

how do you calculate median?

what is the difference between mean (average) and median?
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16288241
>>how do you calculate median?

Sort them and take the middle value

>>what is the difference ...

(See above)
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question