How to store data from analog sensor to perform Statistical Operation

Dear All,

I want to record the data from temperature sensor and perform statistical operation on it, like finding the mean, mode and SD. Can anybody suggest the best way to do it?

I was thinking to store the data in array and then perform statistics on it.

Thanking you.

How much data and of what type do you need to store at any one time ?

Dear Sir,

I want to store 100 data points, float type. There is successive gap of 1 second between two data points.

manish_hiray:
Dear All,

I want to record the data from temperature sensor and perform statistical operation on it, like finding the mean, mode and SD. Can anybody suggest the best way to do it?

I was thinking to store the data in array and then perform statistics on it.
...
I want to store 100 data points, float type. There is successive gap of 1 second between two data points.

Storing 100 floats in an array should be no problem. Arduino floats are 4 bytes each, so that's only 400 bytes.

Note however that for many statistical calculations, storing the entire data set is not required. For example, the mean and standard deviation can easily be computed by storing only the sum of the samples and the sum of their squares (and of course the number of samples). This could come in very handy if you want to expand your sample sizes.

Unfortunately for the median, I know of no algorithm for calculating it precisely with continuous data, other than storing and sorting the entire set (at least no algorithm that is universally applicable).

If however you have known bounds on your data and you don't mind the median being somewhat approximate, then you can handle very large data sets by just "binning" them as frequencies over a manageable number of classes (or bins). For example, [0..10), [10..20),[20..30), and so on. It's then very straight forward to find the "median class" of a very large sample without storing every element.