版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、卡尔曼滤波是以最小均方误差为估计的最佳准则,来寻求一套递推估计的算法,其基本思想是:采用信号与噪声的状态空间模型,利用前一时刻地估计值和现时刻的观测值来更新对状态变量的估计,求出现时刻的估计值。它适合于实时处理和计算机运算。卡尔曼滤波的实质是由量测值重构系统的状态向量。它以“预测实测修正”的顺序递推,根据系统的量测值来消除随机干扰,再现系统的状态,或根据系统的量测值从被污染的系统中恢复系统的本来面目。Matlab 程序如下:N=200;w(1=0;w=randn(1,Nx(1=0;a=1;for k=2:N;x(k=a*x(k-1+w(k-1;endV=randn(1,N;q1=std(V;R
2、vv=q1.2;q2=std(x;Rxx=q2.2;q3=std(w;Rww=q3.2;c=0.2;Y=c*x+V;p(1=0;s(1=0;for t=2:N;p1(t=a.2*p(t-1+Rww;b(t=c*p1(t/(c.2*p1(t+Rvv;s(t=a*s(t-1+b(t*(Y(t-a*c*s(t-1;p(t=p1(t-c*b(t*p1(t;endt=1:N;plot(t,s,'r',t,Y,'g',t,x,'b'function x, V, VV, loglik = kalman_filter(y, A, C, Q, R, init_x,
3、 init_V, varargin % Kalman filter.% x, V, VV, loglik = kalman_filter(y, A, C, Q, R, init_x, init_V, .% INPUTS:% y(:,t - the observation at time t% A - the system matrix% C - the observation matrix% Q - the system covariance% R - the observation covariance% init_x - the initial state (column vector%
4、init_V - the initial state covariance% OPTIONAL INPUTS (string/value pairs default in brackets% 'model' - model(t=m means use params from model m at time t ones(1,T % In this case, all the above matrices take an additional final dimension, % i.e., A(:,:,m, C(:,:,m, Q(:,:,m, R(:,:,m.% However
5、, init_x and init_V are independent of model(1.% 'u' - u(:,t the control signal at time t % 'B' - B(:,:,m the input regression matrix for model m% OUTPUTS (where X is the hidden state being estimated% x(:,t = EX(:,t | y(:,1:t% V(:,:,t = CovX(:,t | y(:,1:t% VV(:,:,t = CovX(:,t, X(:,t-
6、1 | y(:,1:t t >= 2% loglik = sumt=1T log P(y(:,t% If an input signal is specified, we also condition on it:% e.g., x(:,t = EX(:,t | y(:,1:t, u(:, 1:t% If a model sequence is specified, we also condition on it:% e.g., x(:,t = EX(:,t | y(:,1:t, u(:, 1:t, m(1:tos T = size(y;ss = size(A,1; % size of
7、state space% set default paramsmodel = ones(1,T;u = ;B = ;ndx = ;args = varargin;nargs = length(args;for i=1:2:nargsswitch argscase 'model', model = argsi+1;case 'u', u = argsi+1;case 'B', B = argsi+1;case 'ndx', ndx = argsi+1;otherwise, error('unrecognized argume
8、nt ' argsendendx = zeros(ss, T;V = zeros(ss, ss, T;VV = zeros(ss, ss, T;loglik = 0;for t=1:Tm = model(t;if t=1%prevx = init_x(:,m;%prevV = init_V(:,:,m;prevx = init_x;prevV = init_V;initial = 1;elseprevx = x(:,t-1;prevV = V(:,:,t-1;initial = 0;endif isempty(ux(:,t, V(:,:,t, LL, VV(:,:,t = .kalma
9、n_update(A(:,:,m, C(:,:,m, Q(:,:,m, R(:,:,m, y(:,t, prevx, prevV, 'initial', initial;elseif isempty(ndxx(:,t, V(:,:,t, LL, VV(:,:,t = .kalman_update(A(:,:,m, C(:,:,m, Q(:,:,m, R(:,:,m, y(:,t, prevx, prevV, . 'initial', initial, 'u', u(:,t, 'B', B(:,:,m;elsei = ndx;% copy over all elements; only some will get updatedx(:,t = prevx;prevP = inv(prevV;prevPsmall = prevP(i,i;prevVsmall = inv(prevPsmall;x(i,t, smallV, LL, VV(i,i,t = .kalman_update(A(i,i,m, C(:,i,m, Q(i,i,m, R(:,:,m, y(:,t, prevx(i, prevVsmall, .
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026届河北T8联考高三下学期4月联合测评英语+答案
- 2025杭州电子科技大学信息工程学院教师招聘考试题目及答案
- 2026年江西餐饮服务资格考试及答案
- 洛阳二建试卷试题及答案
- 2026北京市法院系统招聘聘用制审判辅助人员53人建设考试备考题库及答案解析
- 2026福建龙岩市第一医院医疗辅助岗位招聘4人建设笔试参考题库及答案解析
- 2026广东省惠东县教育局赴高校招聘公办学校教师126人(惠州场)建设笔试备考题库及答案解析
- 2026黑龙江黑河市鸿兴资本运营有限公司招聘工作人员12人建设笔试参考题库及答案解析
- 2026浙江温州市乐清市龙西乡卫生院招聘1人建设考试参考题库及答案解析
- 绍兴市镜湖开发集团有限公司下属企业招聘工作人员5人建设笔试备考试题及答案解析
- 第5课 从小爱劳动 课件(内嵌视频) 2025-2026学年道德与法治三年级下册统编版
- 一年级数学10以内加减法计算专项练习题(每日一练共12份)
- 2026特种作业场内专用机动车辆作业考试题及答案
- (二模)苏北七市2026届高三第二次调研测试生物试卷(含答案)
- TCABEE080-2024零碳建筑测评标准(试行)
- 遗传性高胆红素血症诊疗专家共识(2025年版)解读课件
- (正式版)DB37∕T 4863-2025 《数字经济发展评价指标体系》
- 安全风险辨识记录
- 供方履约评价表(工程施工类)
- 风湿性多肌痛的诊断与治疗课件
- 烤箱能效测试标准
评论
0/150
提交评论