Go Down

Topic: runningMedian class on playground (Read 19321 times) previous topic - next topic

Wareemba

#75
Jan 29, 2016, 11:40 am Last Edit: Jan 29, 2016, 11:52 am by Wareemba
You can also analyse the code of the class.


ah, so where it states:
Code: [Select]
double getAverage(uint8_t nMedian);

whatever is the in () in the sketch is the 'n' :) this was not obvious, but now is! so if my N is larger, then i can widen my n to see how it looks? but i really want to be just using median() for my readings i think? or DO i want to be using a "middle average" of the sensors readings?

any thoughts on DHT22 sensor sampling frequency? closer together - or further apart?

and why is N set to a maximum of 19? is looking at more than 19 not worth it? or is it processor power related?

oh - and what happens with a NaN?? is it discarded? or left in and ignored?

robtillaart

#76
Jan 29, 2016, 08:25 pm Last Edit: Jan 29, 2016, 08:57 pm by robtillaart
>> ah, so where it states: double getAverage(uint8_t nMedian);

That function but then in  the .cpp file

>> so if my N is larger, then i can widen my n to see how it looks?
Yes

>> but i really want to be just using median() for my readings i think?
I assume you know what you think, but yes

>> or DO i want to be using a "middle average" of the sensors readings?
It is your project so you define your requirements. Normally median() should work for you. The average(5); can be useful if you want one decimal place but the sensor does only return integers e.g. the DHT11.

>> any thoughts on DHT22 sensor sampling frequency? closer together - or further apart?
You can make high frequency measurements (20x / minute) and see that the temp/hum changes are changing only once per 5 minutes. That would be overkill. Make a test run and check the fastest change you see and compare that to the smallest change you want to see.
E.g. if you want to see every 0.1 delta in temp you must probably sample fast. If you are interested in only 0.5 or 1.0 changes you can sample a lot less. Especially when run on batteries you want to minimize power usage.

>> and why is N set to a maximum of 19?
Because it can be done? It is just a demo program, I can do a theoretical course about median, but read wikipedia about it and think for yourself when you should use a bigger buffer and when a smaller?
when 5, when 11, when 19 or even bigger. What happens to the data stream if you do so?
Why did you just copy it?

>>  is looking at more than 19 not worth it?
You determine the requirements

>> or is it processor power related?
No on board memory and common sense

>>oh - and what happens with a NaN?? is it discarded? or left in and ignored?
Not handled, good point.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

flrs

runningMedian folks,

I just published the Hampel filter library which identifies outliers not only based on the median, but also based on the distribution of the data. Find the library on GitHub and the related forum post here.

flrs

SkobyMobil

Hello,
This all works wonderfully, but-
2 things I do not get in the sketch ...

How to delete counters and variables?
How do I find the value that is most common?
With "mode ()"? If yes how?

Many thanks for your help
Greeting and fun
Andreas
die zweite Maus bekommt den Speck...

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy