新聞中心

        EEPW首頁 > 嵌入式系統(tǒng) > 設(shè)計應(yīng)用 > 卡爾曼濾波在單片機上的使用

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

        作者: 時間:2016-11-29 來源:網(wǎng)絡(luò) 收藏






        #ifndef _KALMAN_H_
        #define _KALMAN_H_

        本文引用地址:http://www.104case.com/article/201611/323547.htm

        extern KalmanGain;// 卡爾曼增益
        extern EstimateCovariance;//估計協(xié)方差
        extern MeasureCovariance;//測量協(xié)方差
        extern EstimateValue;//估計值
        extern void KalmanFilterInit(void);
        extern KalmanFilter( Measure);
        #endif

        #include "config.h"
        #include "math.h"

        KalmanGain;// 卡爾曼增益
        EstimateCovariance;//估計協(xié)方差
        MeasureCovariance;//測量協(xié)方差
        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);
        //更新估計協(xié)方差

        EstimateCovariance=sqrt(1-KalmanGain)*EstimateCovariance;
        //更新測量方差
        MeasureCovariance=sqrt(1-KalmanGain)*MeasureCovariance;
        //返回估計值
        return EstimateValue;
        }



        關(guān)鍵詞: 卡爾曼濾波單片

        評論


        技術(shù)專區(qū)

        關(guān)閉
        主站蜘蛛池模板: 那坡县| 湖州市| 南靖县| 乌拉特后旗| 商水县| 徐水县| 刚察县| 泰安市| 门源| 即墨市| 台江县| 大同县| 宣城市| 翁源县| 昂仁县| 涿州市| 肇源县| 永吉县| 苏尼特左旗| 余干县| 定南县| 抚松县| 利辛县| 迁安市| 高雄县| 宝鸡市| 灵宝市| 合肥市| 集贤县| 张家口市| 洛南县| 工布江达县| 新野县| 乌拉特后旗| 江川县| 文成县| 红原县| 盐池县| 淮北市| 南雄市| 和平县|