请matlab高手解决kalman问题A=[0.49,0.298,0.412;0.401,-0.391,0.391;-0.992,0.401,0.296];B=zeros(3.3);G=eye(3,3);C=[0,1,0];D=[0,0,0];H=zeros(1,3);X(:,1)=[10.9,8.481,-4.3]';guji=[20.1,21.3,20.7]';for i=2:30 W=randn(3,1); V=randn(1,1); X(:,
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/19 09:15:17
请matlab高手解决kalman问题A=[0.49,0.298,0.412;0.401,-0.391,0.391;-0.992,0.401,0.296];B=zeros(3.3);G=eye(3,3);C=[0,1,0];D=[0,0,0];H=zeros(1,3);X(:,1)=[10.9,8.481,-4.3]';guji=[20.1,21.3,20.7]';for i=2:30 W=randn(3,1); V=randn(1,1); X(:,
请matlab高手解决kalman问题
A=[0.49,0.298,0.412;0.401,-0.391,0.391;-0.992,0.401,0.296];
B=zeros(3.3);
G=eye(3,3);
C=[0,1,0];
D=[0,0,0];
H=zeros(1,3);
X(:,1)=[10.9,8.481,-4.3]';
guji=[20.1,21.3,20.7]';
for i=2:30
W=randn(3,1);
V=randn(1,1);
X(:,i)=A*X(:,i-1);
X1(:,i)=X(:,i)+W;
On=eye(2,2);
Rn=1;
Nn=0;
Z0(:,i)=C*X1(:,i)+V;
sys=ss(A,[B,G],C,[D,H],-1);
[kest,L,P,M,Z]=kalman(sys,On,Rn,Nn);
guji(:,i)=A*guji(:,i-1)+L*A*guji(:,i-1);
end
subplot(2,2,1);
plot(x(1,:))
hold on
plot(guji(1,:),':m')
hold off
legend('real of X1','estimate of X1')
grid
subplot(2,2,2)
hold on
plot(guji(2,:),':m')
hold off
legend('real of X2','estimate of X2')
grid
subplot(2,2,3:4)
plot(X(3,:))
hold on
plot(guji(3,:),':m')
hold off
legend('real of X1','estimate of X1')
grid
Warning: Size vector should be a row vector with integer elements.
不胜感激!
请matlab高手解决kalman问题A=[0.49,0.298,0.412;0.401,-0.391,0.391;-0.992,0.401,0.296];B=zeros(3.3);G=eye(3,3);C=[0,1,0];D=[0,0,0];H=zeros(1,3);X(:,1)=[10.9,8.481,-4.3]';guji=[20.1,21.3,20.7]';for i=2:30 W=randn(3,1); V=randn(1,1); X(:,
A=[0.49,0.298,0.412;0.401,-0.391,0.391;-0.992,0.401,0.296];
B=zeros(3,3);G=eye(3,3);C=[0,1,0];D=[0,0,0];
H=zeros(1,3);X(:,1)=[10.9,8.481,-4.3]';
guji=zeros(3,30);
guji(:,1)=[20.1,21.3,20.7]';
for i=2:30
W=randn(3,1);
V=randn(1,1);
X(:,i)=A*X(:,i-1);
X1(:,i)=X(:,i)+W;
On=eye(2,2); Rn=1;
Nn=0;
Z0(:,i)=C*X1(:,i)+V;
sys=ss(A,[B,G],C,[D,H],-1);
[kest,L,P,M,Z]=kalman(sys,On,Rn,Nn);
guji(:,i)=A*guji(:,i-1)+L'*A*guji(:,i-1);
end
subplot(2,2,1);plot(X1(1,:))
hold on
plot(guji(1,:),':m')
hold off
legend('real of X1','estimate of X1')
grid
subplot(2,2,2)
hold on
plot(guji(2,:),':m')
hold off
legend('real of X2','estimate of X2')
grid
subplot(2,2,3:4)
plot(X(3,:))
hold on
plot(guji(3,:),':m')
hold off
legend('real of X1','estimate of X1')
grid
按上面语句试试