找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 1731|回復(fù): 0
打印 上一主題 下一主題
收起左側(cè)

卡爾曼濾波

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
樓主
ID:136419 發(fā)表于 2016-8-10 12:14 | 只看該作者 回帖獎(jiǎng)勵(lì) |正序?yàn)g覽 |閱讀模式

#ifndef _KALMAN_H_
#define _KALMAN_H_
extern  KalmanGain;//  卡爾曼增益
extern  EstimateCovariance;//估計(jì)協(xié)方差
extern  MeasureCovariance;//測量協(xié)方差
extern  EstimateValue;//估計(jì)值
extern void KalmanFilterInit(void);
extern      KalmanFilter(   Measure);
#endif
#include "config.h"
#include "math.h"
  KalmanGain;//  卡爾曼增益
  EstimateCovariance;//估計(jì)協(xié)方差
  MeasureCovariance;//測量協(xié)方差
  EstimateValue;//估計(jì)值
void KalmanFilterInit(void);
extern    float  KalmanFilter(float   Measure);
void KalmanFilterInit(void)
{
EstimateValue=0;
EstimateCovariance=0.1;
MeasureCovariance=0.02;
}
KalmanFilter(   Measure)
{
//計(jì)算卡爾曼增益
KalmanGain=EstimateCovariance*sqrt(1/(EstimateCovariance*EstimateCovariance+MeasureCovariance*MeasureCovariance));
//計(jì)算本次濾波估計(jì)值
EstimateValue=EstimateValue+KalmanGain*Measure-EstimateValue);
//更新估計(jì)協(xié)方差
EstimateCovariance=sqrt(1-KalmanGain)*EstimateCovariance;
//更新測量方差
MeasureCovariance=sqrt(1-KalmanGain)*MeasureCovariance;
//返回估計(jì)值
return EstimateValue;
}

評(píng)分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎(jiǎng)勵(lì)!

查看全部評(píng)分

分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏1 分享淘帖 頂 踩
回復(fù)

使用道具 舉報(bào)

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表