Sliding window algorithm problem
Show older comments
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
Answers (0)
Categories
Find more on MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!