当前位置:网站首页>KF UD分解之UD分解基础篇【1】
KF UD分解之UD分解基础篇【1】
2022-07-06 09:18:00 【Proletarians】
在进行KF UD分解的时候,状态向量的方差-协方差阵P是用UD形式表示的,UD分解是其基础,而此篇文章的目的是能减少大家在进行UD分解的学习时间,如果能起到抛砖引玉的作用就再好不过了。
一、本章学习目的有三:
首先,我们要清楚,什么样的矩阵才是对称正定矩阵?
其次,我们要知道,UD分解的形式如下:P=UDU^T,其中,U是单位上三角矩阵,D是对角矩阵。
最后,我们要能进行代码实现,即给定对称正定矩阵P,可以得到矩阵U和D。
下面为偷懒操作,直接放文档截图了。。。
在matlab中手写UD分解的代码如下,请忽略代码健壮性:
% 实现对称正定矩阵的UD分解
% demo
% U = 1 2 3 4 D = 1 0 0 0 P = 95 66 38 16
% 0 1 2 3 0 3 0 0 66 47 28 12
% 0 0 1 2 0 0 2 0 38 28 18 8
% 0 0 0 1 0 0 0 4 16 12 8 4
P=[95 66 38 16;
66 47 28 12;
38 28 18 8;
16 12 8 4];
% P=[ 220 166 113 66 25
% 166 127 88 52 20
% 113 88 63 38 15
% 66 52 38 24 10
% 25 20 15 10 5];
% UD分解原则(从右往左,从下往上,先列后行)
% 由于P是对称正定矩阵,只需要对P的上三角元素做处理
% 1、计算P的矩阵列数
[pi,pj]=size(P);
U=diag(ones(pi,1));
D=diag(ones(pi,1));
if pj>1
disp('matrix P is ok!')
for i=pj:-1:1
Pii=P(i,i);
P_D_num=pj-i; % 根据Pii来计算Dii时,需要D元素的个数
u2d=0.0;
if P_D_num>0
ip1=i+1;
for k=ip1:pj
u2d=u2d+D(k,k)*U(i,k)*U(i,k);
end
end
D(i,i)=Pii-u2d; % dii
disp(['P_col= ',num2str(i)])
if i==1
disp('UD over!') % 第一列
elseif i==pj
for j=1:pj-1
U(j,pj)=P(j,pj)/D(i,i); % 最后一列
end
else
ip1=i+1; % plus 1
im1=i-1; % minus 1
for k=1:im1;
disp(['P_row= ',num2str(k)])
udu=0.0;
for j=ip1:pj
udu=udu+U(k,j)*U(i,j)*D(j,j);
end
if j==pj
U(k,i)=(P(k,i)-udu)/D(i,i);
end
end
end
disp('-----------')
end
end
disp('D')
D
disp('U')
U
边栏推荐
- Fairygui character status Popup
- 單片機藍牙無線燒錄
- Custom view puzzle getcolor r.color The color obtained by colorprimary is incorrect
- Mysql database index
- MySQL time, time zone, auto fill 0
- Pytorch: tensor operation (I) contiguous
- [leetcode622]设计循环队列
- 2021.11.10汇编考试
- [899] ordered queue
- Unity3D基础入门之粒子系统(属性介绍+火焰粒子系统案例制作)
猜你喜欢
随机推荐
Symbolic representation of functions in deep learning papers
@The difference between Autowired and @resource
[899]有序队列
idea问题记录
Pat 1097 duplication on a linked list (25 points)
Esp8266 connect onenet (old mqtt mode)
Fairygui gain buff value change display
PR 2021 quick start tutorial, first understanding the Premiere Pro working interface
(一)R语言入门指南——数据分析的第一步
[offer18] delete the node of the linked list
(core focus of software engineering review) Chapter V detailed design exercises
Get the position of the nth occurrence of the string
Intermediate use tutorial of postman [environment variables, test scripts, assertions, interface documents, etc.]
Affichage du changement de valeur du Buff de gain de l'interface graphique de défaillance
(四)R语言的数据可视化——矩阵图、柱状图、饼图、散点图与线性回归、带状图
JS regular expression basic knowledge learning
MySQL时间、时区、自动填充0的问题
(五)R语言入门生物信息学——ORF和序列分析
Idea problem record
JS function promotion and declaration promotion of VaR variable