Sliding window algorithm problem

2 次查看(过去 30 天)
Ambarish
Ambarish 2014-4-10
I am suppose to get estimates for few samples then after providing a step input at 60 and not get estimates post the window .I am enclosing my code ,please let me know what changes can be done
clc
clear all
n=70;
M=50;
x=zeros(1,n);
y(1)=0;
y(2)=0;
y(3)=0;
phi=zeros(M,6);
theta=zeros(6,1);
z=zeros(M,1);
for i=4:n+4
if (i>=60)
x(i)=1;
end
y(i)=1.98*y(i-1)-1.284*y(i-2)+0.272*y(i-3)+4*x(i-1)+6*x(i-2)+8*x(i-3);
z=[y(i);z(1:M-1)];
si=[x(i-1) x(i-2) x(i-3) -y(i-1) -y(i-2) -y(i-3) ];
phi=[si;phi(1:M-1,:)];
if(i > M+3)
theta1=phi\z;
thetaest(:,i)=theta1;
end
end
Thank You

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by