ImageVerifierCode 换一换
格式:DOCX , 页数:11 ,大小:36.86KB ,
资源ID:11012950      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bingdoc.com/d-11012950.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(75卡尔曼滤波器.docx)为本站会员(b****1)主动上传,冰点文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰点文库(发送邮件至service@bingdoc.com或直接QQ联系客服),我们立即给予删除!

75卡尔曼滤波器.docx

1、75 卡尔曼滤波器7.5 卡尔曼滤波器由于维纳滤波器难以用于实时处理,满足不了20世纪50年代航天航空技术发展的要求,于是人们开始探索新的理论和技术途径。20世纪60年代新出现的卡尔曼滤波理论,用信号与噪声的状态空间模型取代了相关函数,用时域的微分方程来表示滤波问题,得到了递推估计算法,适用于计算机实时处理,它突破了维纳滤波的平稳过程的限制,也没有无限时间的要求,这一对维纳滤波理论的重大突破很快地被用于空间技术、自动控制和信号处理等领域。卡尔曼滤波由滤波方程和预测方程两部分组成。7.5.1 滤波基本方程设信号状态方程和量测方程分别为 (7-133) (7-134)式中,为信号的状态向量,为量测

2、向量,和分别为状态噪声和量测噪声,且为互不相关的高斯白噪声向量序列,其协方差分别为和;,和分别为状态转移矩阵、输入矩阵和观测矩阵。卡尔曼滤波基本方程为 (7-135) (7-136) (7-137) (7-138) (7-139)其中,残差(新息)定义为 (7-140)协方差矩阵为 (7-141)7.5.2 一步预测基本方程卡尔曼一步预测基本方程为 (7-142) (7-143) (7-144)式中,为一步预测增益阵。【例7-16】利用卡尔曼滤波器跟踪机动目标。例程7-14 基于卡尔曼滤波器的机动目标跟踪% Make a point move in the 2D plane% State =

3、(x y xdot ydot). We only observe (x y).% X(t+1) = (t) X(t) + noise(Q)% Y(t) = H X(t) + noise(R)ss = 4; % state sizeos = 2; % observation sizeF = 1 0 1 0; 0 1 0 1; 0 0 1 0; 0 0 0 1; H = 1 0 0 0; 0 1 0 0;Q = 0.1*eye(ss);R = 1*eye(os);initx = 10 10 1 0; %target initial parametersinitV = 10*eye(ss);seed

4、 = 9;rand(state, seed);randn(state, seed);T = 15;x,y = sample_lds(F, H, Q, R, initx, T); %generate target data%kalman filter xfilt, Vfilt, VVfilt, loglik = kalman_filter(y, F, H, Q, R, initx, initV); % one step predictxsmooth, Vsmooth = kalman_smoother(y, F, H, Q, R, initx, initV);%calculate the err

5、or between the filtered data and the real data dfilt = x(1 2,:) - xfilt(1 2,:); mse_filt = sqrt(sum(sum(dfilt.2); dsmooth = x(1 2,:) - xsmooth(1 2,:);mse_smooth = sqrt(sum(sum(dsmooth.2)figure(1)clf%subplot(2,1,1)hold onplot(x(1,:), x(2,:), ks-);plot(y(1,:), y(2,:), g*);plot(xfilt(1,:), xfilt(2,:),

6、rx:);for t=1:T, plotgauss2d(xfilt(1:2,t), Vfilt(1:2, 1:2, t); endhold offlegend(true, observed, filtered, 3)xlabel(x)ylabel(y)% 3x3 inchesset(gcf,units,inches);set(gcf,PaperPosition,0 0 3 3) %print(gcf,-depsc,/home/eecs/murphyk/public_html/Bayes/Figures/aima_filtered.eps);%print(gcf,-djpeg,-r100, /h

7、ome/eecs/murphyk/public_html/Bayes/Figures/aima_filtered.jpg);figure(2)%subplot(2,1,2)hold onplot(x(1,:), x(2,:), ks-);plot(y(1,:), y(2,:), g*);plot(xsmooth(1,:), xsmooth(2,:), rx:);for t=1:T, plotgauss2d(xsmooth(1:2,t), Vsmooth(1:2, 1:2, t); endhold offlegend(true, observed, smoothed, 3)xlabel(x)yl

8、abel(y)% 3x3 inchesset(gcf,units,inches);set(gcf,PaperPosition,0 0 3 3) %print(gcf,-djpeg,-r100, /home/eecs/murphyk/public_html/Bayes/Figures/aima_smoothed.jpg);%print(gcf,-depsc,/home/eecs/murphyk/public_html/Bayes/Figures/aima_smoothed.eps);图7-27 卡尔曼滤波器跟踪机动目标仿真图7-27中“”表示机动目标的真实轨迹,“”表示目标观测轨迹,“”表示经卡

9、尔曼滤波后的目标轨迹,圆表示跟踪波门。可以看出,卡尔曼滤波器能较为准确地跟踪机动目标。函数kalman_filter和 kalman_update分别是实现卡尔曼滤波方程滤波和状态更新的代码。function x, V, VV, loglik = kalman_filter(y, A, C, Q, R, init_x, 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

10、 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 % init_V - the initial state covariance % OPTIONAL INPUTS (string/value pairs default in brackets)% model - model(t)=m means use params

11、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, 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 mo

12、del 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-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

13、(:, 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:t)os T = size(y);ss = size(A,1); % size of state space% set default paramsmodel = ones(1,T);u = ;B = ;ndx = ;args = varargin;nargs = length(args);for i=1:2:nargs switch argsi case

14、model, model = argsi+1; case u, u = argsi+1; case B, B = argsi+1; case ndx, ndx = argsi+1; otherwise, error(unrecognized argument argsi) endendx = zeros(ss, T);V = zeros(ss, ss, T);VV = zeros(ss, ss, T);loglik = 0;for t=1:T m = model(t); if t=1 %prevx = init_x(:,m); %prevV = init_V(:,:,m); prevx = i

15、nit_x; prevV = init_V; initial = 1; else prevx = x(:,t-1); prevV = V(:,:,t-1); initial = 0; end if isempty(u) x(:,t), V(:,:,t), LL, VV(:,:,t) = . kalman_update(A(:,:,m), C(:,:,m), Q(:,:,m), R(:,:,m), y(:,t), prevx, prevV, initial, initial); else if isempty(ndx) x(:,t), V(:,:,t), LL, VV(:,:,t) = . ka

16、lman_update(A(:,:,m), C(:,:,m), Q(:,:,m), R(:,:,m), y(:,t), prevx, prevV, . initial, initial, u, u(:,t), B, B(:,:,m); else i = ndxt; % copy over all elements; only some will get updated x(:,t) = prevx; prevP = inv(prevV); prevPsmall = prevP(i,i); prevVsmall = inv(prevPsmall); x(i,t), smallV, LL, VV(

17、i,i,t) = . kalman_update(A(i,i,m), C(:,i,m), Q(i,i,m), R(:,:,m), y(:,t), prevx(i), prevVsmall, . initial, initial, u, u(:,t), B, B(i,:,m); smallP = inv(smallV); prevP(i,i) = smallP; V(:,:,t) = inv(prevP); end end loglik = loglik + LL;endfunction xnew, Vnew, loglik, VVnew = kalman_update(A, C, Q, R,

18、y, x, V, varargin)% KALMAN_UPDATE Do a one step update of the Kalman filter% xnew, Vnew, loglik = kalman_update(A, C, Q, R, y, x, V, .)% INPUTS:% A - the system matrix% C - the observation matrix % Q - the system covariance % R - the observation covariance% y(:)- the observation at time t% x(:) - EX

19、 | y(:, 1:t-1) prior mean% V(:,:) - CovX | y(:, 1:t-1) prior covariance% OPTIONAL INPUTS (string/value pairs default in brackets)% initial - 1 means x and V are taken as initial conditions (so A and Q are ignored) 0% u- u(:) the control signal at time t % B- the input regression matrix% OUTPUTS (whe

20、re X is the hidden state being estimated)% xnew(:) =E X | y(:, 1:t) % Vnew(:,:) = Var X(t) | y(:, 1:t) % VVnew(:,:) = Cov X(t), X(t-1) | y(:, 1:t) % loglik = log P(y(:,t) | y(:,1:t-1) log-likelihood of innovatio% set default paramsu = ;B = ;initial = 0;args = varargin;for i=1:2:length(args) switch a

21、rgsi case u, u = argsi+1; case B, B = argsi+1; case initial, initial = argsi+1; otherwise, error(unrecognized argument argsi) endend% xpred(:) = EX_t+1 | y(:, 1:t)% Vpred(:,:) = CovX_t+1 | y(:, 1:t)if initial if isempty(u) xpred = x; else xpred = x + B*u; end Vpred = V;else if isempty(u) xpred = A*x

22、; else xpred = A*x + B*u; end Vpred = A*V*A + Q;ende = y - C*xpred; % error (innovation)n = length(e);ss = length(A);S = C*Vpred*C + R;Sinv = inv(S);ss = length(V);loglik = gaussian_prob(e, zeros(1,length(e), S, 1);K = Vpred*C*Sinv; % Kalman gain matrix% If there is no observation vector, set K = zeros(ss).xnew = xpred + K*e;Vnew = (eye(ss) - K*C)*Vpred;VVnew = (eye(ss) - K*C)*A*V;

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2