From: Yaw on
I used this code for ID implementation of the LMS algorithm. Can someone help me to change it to a 2D. I want to apply it to images.

L = 1000;
stepsize = 0.05;
u = zeros(1,L);
for i = 3:L
u(i) = -0.1*u(i-1)+0.8*u(i-2)+sqrt(0.27)*randn(1,1);
end

w(1:2,1) = [0;0]; %w=zeros(2,1)
for n = 1:L-3
x = [u(n+2);u(n+1)];
f(n) = u(n+3) - w(1:2,n)'*x;
w(1:2,n+1) = w(1:2,n) + stepsize*x*f(n);
end