y(2)=2; y(3)=4; y(4)=5; x = rand(1,100); plot(x); title('input') for n=5:1:100 y(n)=1.98*y(n-1)-1.284*y(n-2)+0.272*y(n-3)+4*x(n-1)+6*x(n-2)+8*x(n-3); end;
figure plot(y) title('cleaned')
for i=5:1:100; phi(i,:)=[ -y(i-1) -y(i-2) -y(i-3) x(i-1) x(i-2) x(i-3) ]; end; theta = (phi'* phi)\phi'*y'; (This is not correct as y vector not scalier and not sure of the equation)
for n=2:1:100 e(n,:)=y(n)-phi'*theta(n-1,:) (looks correct) p(n,:)= p(n-1)-[p(n-1,:)*phi*phi'*p(n-1,:)]/[ 1+phi'*p(n-1,:)*phi] (Not correct Equation) k(n,:)=p(n,:)*phi (correct) theta(n,:)= theta(n,:)+k(n)*e(n) (Correct) end;
you need to review the theory well then try to apply the equations with taking care of the vectors dimensions as well.
all the best
