Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

MEDIAN FILTER,FOR BASIC 3

Status
Not open for further replies.

DANTHEELECTRICMAN

Electrical
May 24, 2013
14
HELLO: WELL I HAVE SPENT MOST OF THE DAY READING ONLINE ARTICLES ABOUT CODING FOR A MEDIAN FILTER. EVEN TRIED AN EXAMPLE,STILL OVER MY HEAD...I HAVE A 22 BIT ADC FOR A CO2 SENSOR,OUTPUT IS IN P.P.M., SO AT 5% GAS OR (50,000 PPM IS WHAT I WILL DISPLAY),THE READING IS A LITTLE JUMPY. LIKE 50,130, 50,090, 50,000, 50,065...SO FORTH. I HAVE READ THAT A MEDIAN FILTER IS A GREAT WAY TO RID THE NOISE FROM THE DATA. ANYWAY I CAN USE SOME EXPERTISE EVEN A CODE EXAMPLE IN BASIC...EVEN A GOOD BOOK OR WEBSITE TO STUDY WITH EXAMPLES. ANY HELP UNDERSTANDING HOW TO CODE THIS WILL BE VERY APPRECIATED....THANK YOU.P.S. SEE THE LINK ATTACHED.
 
Replies continue below

Recommended for you

If a display is jumpy, just average the last 'X' values. After 10 reads, average the 10 readings and display that. When a new reading comes in, throw the oldest away and calculate a new average.


Dan - Owner
Footwell%20Animation%20Tiny.gif
 
THANKS FOR THE REPLY: I DID TRY THE AVERAGING TECHNIQUE,IT HELPS A LOT. THERE IS STILL THAT ANOMALOUS READING THAT POPS US DUE TO THE FACT I AVERAGE IN THE NOISE WITH THE ACTUAL DATA....FROM WHAT I READ ABOUT THE MEDIAN TYPE FILTER IT IS LESS LIKELY TO HAVE ANY OF THE NOISE IN THE FINAL AFTER THE MATH..IF YOU OR ANY ONE KNOWS OF A CODE EXAMPLE (IN BASIC) FOR A MEDIAN TYPE FILTER THAT WOULD BE HELPFUL..I SENT THE LINK FOR EMESYSTEMS.COM..(I GUESS I NEED MORE HELP THEN THAT???)..
 
Please refrain from using all caps; I don't get why no one has mentioned this to you before now.

Median filters work best with salt&pepper noise; for the example you gave, it will not make much of a difference. Nonetheless, there are examples on the Mathworks site for Matlab:

Or:
TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529
 
thanks for the reply: what is the matter with the caps????..anyway thanks for the link,actually i need code example in basic programing language for a running average routine...thank you all for any info..
 
All caps are inherently more difficult to read, since 99.99% of all text is in Sentence case or Title Case. Because most people are not used to reading all caps, they require more work to recognize and process the words. Moreover, in some circles, all caps is considered to be equivalent to shouting by an obnoxious person.

All text-based procedural languages are fairly similar in structure; multiplications are multiplications, arrays are usually fairly recognizable.

TTFN
faq731-376
7ofakss

Need help writing a question or understanding a reply? forum1529
 
MacGyverS2000 gave you the algorithm in meta-code already.
Read his message again.


Mike Halloran
Pembroke Pines, FL, USA
 
OK THANKS FOR ALL THE INPUT....I REALLY DO APPRECIATE IT...I WAS ASKING FOR A CODE EXAMPLE...I FINALLY FIGURED IT OUT ON MY OWN,THANKS AGAIN...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor