[单片机分享] 教你在单片机上套公式实现卡尔曼滤波器
来源:互联网 发布:linux嵌入式开发工资 编辑:程序博客网 时间:2024/06/07 05:08
http://bbs.elecfans.com/jishu_484132_1_1.html
逛博客看到的一篇讲解卡尔曼滤波的文章,发现程序十分简洁易懂,而且使用效果不错,是一个学习的典范,在此分享了!
#ifndef _KALMAN_H_
#define _KALMAN_H_
extern KalmanGain;// 卡尔曼增益
extern EstimateCovariance;//估计协方差
extern MeasureCovariance;//测量协方差
extern EstimateValue;//估计值
extern void KalmanFilterInit(void);
extern KalmanFilter( Measure);
#endif
#include "config.h"
#include "math.h"
KalmanGain;// 卡尔曼增益
EstimateCovariance;//估计协方差
MeasureCovariance;//测量协方差
EstimateValue;//估计值
void KalmanFilterInit(void);
extern float KalmanFilter(float Measure);
void KalmanFilterInit(void)
{
EstimateValue=0;
EstimateCovariance=0.1;
MeasureCovariance=0.02;
}
KalmanFilter( Measure)
{
//计算卡尔曼增益
KalmanGain=EstimateCovariance*sqrt(1/(EstimateCovariance*EstimateCovariance+MeasureCovariance*MeasureCovariance));
//计算本次滤波估计值
EstimateValue=EstimateValue+KalmanGain*(Measure-EstimateValue);
//更新估计协方差
EstimateCovariance=sqrt(1-KalmanGain)*EstimateCovariance;
//更新测量方差
MeasureCovariance=sqrt(1-KalmanGain)*MeasureCovariance;
//返回估计值
return EstimateValue;
}
- [单片机分享] 教你在单片机上套公式实现卡尔曼滤波器
- 卡尔曼滤波在单片机上的使用
- 卡尔曼滤波在单片机上的使用
- 卡尔曼滤波器及代码实现
- MATLAB实现卡尔曼滤波器(KF、EKF)
- 卡尔曼滤波器从原理到实现
- 单片机中(C语言)IIR滤波器的实现
- 单片机中(C语言)IIR滤波器的实现
- 视频教程:卡尔曼滤波器的原理以及在MATLAB中的实现
- 视频教程:卡尔曼滤波器的原理以及在MATLAB中的实现
- [转帖]卡尔曼滤波器
- 卡尔曼滤波器
- 卡尔曼滤波器
- 卡尔曼滤波器
- 卡尔曼滤波器
- 转帖]卡尔曼滤波器
- 卡尔曼滤波器小结
- 卡尔曼滤波器
- object_c id 与 instancetype
- [leetcode] Remove Duplicates from Sorted List
- XShell连接虚拟机Linux
- 【JS总结】——DOM操作表格和样式
- Activity Recognition行为识别
- [单片机分享] 教你在单片机上套公式实现卡尔曼滤波器
- 来淄博旅游
- nginx模块开发入门
- java中对集合List的操作
- 给UIViewController的UINavigationController属性赋值的方法
- JobTracker和TaskTracker
- HDU 2669----Romantic(扩展欧几里德求乘法逆元)
- IP变种繁殖原理、畸形变异 IP 域名
- 04-树8. Complete Binary Search Tree (30)