找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 1770|回复: 0
打印 上一主题 下一主题
收起左侧

卡尔曼滤波

[复制链接]
跳转到指定楼层
楼主
ID:136419 发表于 2016-8-10 12:14 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

#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;
}

评分

参与人数 1黑币 +50 收起 理由
admin + 50 共享资料的黑币奖励!

查看全部评分

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏1 分享淘帖 顶 踩
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表