clear all%递推开始
v=randn(300,1);
na=2;nb=1;nc=0;nk=1;
a1=[1,-0.8,-1];b1=[1,1.5];
a(1)=a1(1)-1;a(2)=a1(2)-a1(1);a(3)=-a1(2);
b(1)=b1(1)-1;b(2)=-b1(1);
x0=[0.0001,0.0001,0.0001,0.0001,0.0001]';x=x0;
p0=10^6*eye(5);
m=0.95;
t=4:1:303;
u(t)=1:1:300;
for t=4:1:303;
y(1)=0,y(2)=0;y(3)=0;
y(t)=-a(1)*y(t-1)-a(2)*y(t-2)-a(3)*y(t-3)+u(t-1)+b(1)*u(t-2)+b(2)*u(t-3)+v(t-3);
h=[-a(1)*y(t-1),-a(2)*y(t-2),-a(3)*y(t-3),b(1)*u(t-2),b(2)*u(t-3)]';
k=p0*h*inv(m+h'*p0*h);
p1=1/m*(ones(5)-k*h')*p0;
p0=p1;
x1=x0+k*(y(t)-y(t-1)-h'*x0);
x0=x1;
x=[x,x0];
end
%The effection is good.bingo!
阅读(710) | 评论(0) | 转发(0) |