欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

專注電子技術學習與研究
當前位置:單片機教程網 >> MCU設計實例 >> 瀏覽文章

卡爾曼濾波在單片機上的使用

作者:佚名   來源:本站原創   點擊數:  更新時間:2012年11月29日   【字體:







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

 

關閉窗口

相關文章