当前位置:网站首页>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
边栏推荐
- 單片機藍牙無線燒錄
- C programming exercise
- FairyGUI按钮动效的混用
- 记一次云服务器被密码爆破的经历——关小黑屋、改密码、改端口
- JS Title: input array, exchange the largest with the first element, exchange the smallest with the last element, and output array.
- PR 2021 quick start tutorial, first understanding the Premiere Pro working interface
- idea中导包方法
- Learning notes of JS variable scope and function
- Unity3d camera, the keyboard controls the front and rear left and right up and down movement, and the mouse controls the rotation, zoom in and out
- (一)R语言入门指南——数据分析的第一步
猜你喜欢

Database course design: college educational administration management system (including code)

基於Redis的分布式ID生成器

341. Flatten nested list iterator

JS regular expression basic knowledge learning

idea中导包方法

(1) Introduction Guide to R language - the first step of data analysis

Gravure sans fil Bluetooth sur micro - ordinateur à puce unique

Office prompts that your license is not genuine pop-up box solution

PR 2021 quick start tutorial, first understanding the Premiere Pro working interface

(4) Data visualization of R language -- matrix chart, histogram, pie chart, scatter chart, linear regression and strip chart
随机推荐
2021.11.10汇编考试
(the first set of course design) 1-4 message passing interface (100 points) (simulation: thread)
(5) Introduction to R language bioinformatics -- ORF and sequence analysis
Walk into WPF's drawing Bing Dwen Dwen
Mysqldump error1066 error solution
[offer78]合并多个有序链表
Unity3d makes the registration login interface and realizes the scene jump
JS Title: input array, exchange the largest with the first element, exchange the smallest with the last element, and output array.
Custom view puzzle getcolor r.color The color obtained by colorprimary is incorrect
(4) Data visualization of R language -- matrix chart, histogram, pie chart, scatter chart, linear regression and strip chart
Agile development helps me
Prove the time complexity of heap sorting
[offer9]用两个栈实现队列
(1) Introduction Guide to R language - the first step of data analysis
First use of dosbox
Talking about the startup of Oracle Database
The dolphin scheduler remotely executes shell scripts through the expect command
[Leetcode15]三数之和
The master of double non planning left the real estate company and became a programmer with an annual salary of 25W. There are too many life choices at the age of 25
Esp8266 connect onenet (old mqtt mode)