Verify the Wiener Algorithms matlab code and Ws are zeros ?

2 views (last 30 days)
Hello, I am new in filtering, I wrote a code for Wiener Algorithm Please verify it and pls guide me weight all Ws are zeros. Please anyone guide me Thanks in advance
% Wiener Algo
N = length(myData);
ord = 20;
x = myData;
w=zeros(1,ord);
mu =0.05;
for i=1:N
e(i) = d(i) - w(i)' * x(i);
w(i+1) = w(i);
end
for i=1:N
yd(i) = sum(w(i)' * x(i));
end

Accepted Answer

Honglei Chen
Honglei Chen on 30 Oct 2013
Are you trying to run LMS algorithm? If that's the case, the code as is does not really modify the weights, w, i.e. the error signal was never put into use. But even then, you need to update the entire weights. In algorithm, w(i) refers to the entire weight vector at iteration i.
  3 Comments
Honglei Chen
Honglei Chen on 30 Oct 2013
Wiener filter has an inversion of covariance matrix. What you did here looks like its LMS implementation. You are not updating the weights right. The error signal needs to come into the picture and the entire weights need to be updated. Right now you are updating each element in the array, that's not what it means by w(i). HTH.
Shara
Shara on 30 Oct 2013
Thanks a lot !!
Actually, I am using same code for LMS just I am updating the mu and previous error like in following LMS code. because LMS update the filtering coefficient with each iteration. Which I understood different between Wiener and LMS just updating the weight. Wiener is not update the weight at each iteration and calculate the weight at time, so see the code for Wiener which I am trying.. Please check both algorithms and give me your feedback, if something is wrong make it correct and put comments. Actually, I am new in this arena and trying to under. Really your help will be highly appreciated !!
% LMS Algo
for i=1:N
e(i) = d(i) - w(i)' * x(i);
w(i+1) = w(i) + mu * e(i) * x(i);
end
% Wiener Algo
for i=1:N
e(i) = d(i) - w(i)' * x(i);
w(i+1) = w(i) + w(i)' * x(i);
% you mean I update error like w(i+1) = w(i)' + e(i) * x(i);
%but I am not getting results
end

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!