# Histogram Library
## Description
One of the main applications for the Arduino board is reading and logging of sensor data.
We often want to make a histogram of this data to get insight of the distribution of the
measurements. This is where this Histogram library comes in.
If you need more quantitative analysis, you might need the statistics library, also available on github.
## Operation
The Histogram distributes the values added to it into buckets and keeps count.
The interface consists of:
* Histogram(uint8_t len, float *bounds); // constructor
* ~Histogram(); // destructor
* void clear(); // reset all counters
* void add(float val); // add a value, increase count
* void sub(float val); // 'add' a value, but decrease count
* uint8_t size(); // number of buckets
* unsigned long count(); // number of values added
* long bucket(uint8_t idx); // count of single bucket
* float frequency(uint8_t idx); // the relative frequency of a bucket
* uint8_t find(float f); // find the bucket for value f
// experimental
* float PMF(float val); // Probability Mass Function
* float CDF(float val); // Cumulative Distribution Function
* float VAL(float prob); // Value
(:sourceend:)
When the class is initialized an array of the boundaries to define the borders of the
buckets is passed to the constructor. This array should be declared global as the
Histogram class does not copy the values to keep memory usage low. This allows to change
the boundaries runtime, so after a clear(), a new Histogram can be created.
Internally the library does not record the individual values, only the count per bucket.
If a new value is added - add() or sub() - the class checks in which bucket it belongs
and the buckets counter is increased.
The sub() function is used to decrease the count of a bucket and it can cause the count
to become below zero. ALthough seldom used but still depending on the application it can
be useful. E.g. when you want to compare two value generating streams, you let one stream
add() and the other sub(). If the histogram is similar they should cancel each other out
(more or less), and the count of all the buckets should be around 0. [not tried].
Frequency() may be removed to reduce footprint as it can be calculated quite easily with
the formula (1.0* bucket(i))/count().
There are three experimental functions: PMF, CDF and VAL.
* PMF is quite similar to frequency, but uses a value as parameter.
* CDF gives the sum of frequencies <= value.
* VAL is CDF inverted.
As the Arduino typical uses a small number of buckets these functions are quite
coarse/inaccurate (linear interpolation within bucket is still to be investigated)
## Todo list
* Copy the boundaries array?
* Always Refactor
* Additional values per bucket.
** Sum, Min, Max, (average acan be derived)
** separate bucket-array for sub()
** improve strategy for find() the right bucket..
** investigate linear interpolation for PMF, CDF and VAL functions to improve accuracy.
** clear individual buckets
** merge buckets
## License
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
没有合适的资源?快使用搜索试试~ 我知道了~
arduino编程库函数合集
共441个文件
ino:147个
properties:60个
h:60个
需积分: 44 78 下载量 115 浏览量
2019-02-17
18:20:31
上传
评论 4
收藏 524KB RAR 举报
温馨提示
来自GitHub分享的arduino库函数合集 支持多种传感器和相应硬件 包含例程 仅供交流学习之用!
资源推荐
资源详情
资源评论
收起资源包目录
arduino编程库函数合集 (441个子文件)
fraction.cpp 10KB
I2C_eeprom.cpp 7KB
Angle.cpp 7KB
dht.cpp 7KB
hmc6352.cpp 6KB
avrheap.cpp 6KB
XMLWriter.cpp 6KB
complex.cpp 6KB
AM232X.cpp 6KB
MCP4725.cpp 5KB
cozir.cpp 5KB
Set.cpp 5KB
dht.cpp 5KB
RunningAverage.cpp 5KB
DAC8554.cpp 4KB
PCF8574.cpp 4KB
max44009.cpp 4KB
MS5611.cpp 4KB
BitArray.cpp 4KB
Statistic.cpp 4KB
RunningMedian.cpp 4KB
FRAM.cpp 4KB
dht2pin.cpp 3KB
dhtnew.cpp 3KB
PulsePattern.cpp 3KB
PCA9685.cpp 3KB
histogram.cpp 3KB
DAC8552.cpp 3KB
radar.cpp 3KB
PCA9635.cpp 3KB
Troolean.cpp 3KB
AD524X.cpp 3KB
FastShiftOut.cpp 3KB
DistanceTable.cpp 2KB
MAX31855.cpp 2KB
DS18B20.cpp 2KB
DAC8551.cpp 2KB
BoolArray.cpp 2KB
CountDown.cpp 2KB
DHT12.cpp 2KB
FastMap.cpp 2KB
PinOutGroup.cpp 1KB
StopWatch.cpp 1KB
FastShiftIn.cpp 1KB
DS28CM00.cpp 1KB
AverageAngle.cpp 1KB
ParPrinter.cpp 1KB
AnalogPin.cpp 1KB
PinInGroup.cpp 1KB
nibbleArray.cpp 928B
IEEE754tools.h 8KB
FunctionGenerator.h 7KB
VT100.h 6KB
MathHelpers.h 4KB
XMLWriter.h 4KB
temperature.h 3KB
I2C_eeprom.h 3KB
BitArray.h 3KB
RunningMedian.h 2KB
Angle.h 2KB
Max44009.h 2KB
dht.h 2KB
cozir.h 2KB
MAX31855.h 2KB
complex.h 2KB
MCP4725.h 2KB
PCA9635.h 2KB
dht.h 2KB
Set.h 2KB
fraction.h 2KB
PinOutGroup.h 2KB
dhtnew.h 2KB
hmc6352.h 2KB
DAC8554.h 2KB
PCA9685.h 2KB
dht2pin.h 2KB
RunningAverage.h 2KB
PCF8574.h 2KB
MultiMap.h 2KB
AM232X.h 2KB
Statistic.h 1KB
Troolean.h 1KB
radar.h 1KB
AD524X.h 1KB
CountDown.h 1KB
avrheap.h 1KB
Par27979.h 1KB
DAC8552.h 1KB
PulsePattern.h 1KB
FRAM.h 1KB
histogram.h 1KB
StopWatch.h 1KB
BoolArray.h 1KB
PinInGroup.h 1KB
MS5611.h 1KB
DAC8551.h 998B
FastMap.h 979B
PrintCharArray.h 952B
AverageAngle.h 868B
FastShiftOut.h 767B
共 441 条
- 1
- 2
- 3
- 4
- 5
资源评论
SwordArt丶
- 粉丝: 7
- 资源: 23
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 常用工具集参考用于图像等数据处理
- 音乐展示网页、基于Stenography的图像数字水印添加与提取,以及基于颜色矩和Tamura算法的图像相似度评估算法py源码
- 基于EmguCV(OpenCV .net封装),图像数字水印加解密算法的实现,其中包含最低有效位算法,离散傅里叶变换算法+文档书
- 基于matlab+DWT的图像水印项目,数字水印+源代码+文档说明+图片+报告pdf
- (优秀毕业设计)基于python实现的数字图像可视化水印系统的设计与实现,多种数字算法实现+源代码+文档说明+理论演示pdf
- 基于DWT-DCT-SVD和deflate压缩的数字水印方法python源码+Gui界面+演示视频(高分毕业设计)
- 基于matlab实现DWT、DCT、SVD算法数字图像水印可视化系统+GUI界面+文档说明+详细注释(高分毕业设计)
- NCIAE-Data-Structure大一大二笔记
- 学习wireshark笔记
- digital-image-数据可视化笔记
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功