Can someone explain why the error and filtered are switching alternatively after each iteration. Is there something wrong with the code itself .
Info
此问题已关闭。 请重新打开它进行编辑或回答。
Can someone explain why the error and filtered signals are switching alternatively.
1 次查看(过去 30 天)
显示 更早的评论
Hello,
I have been working out from a longtime on adaptive filtering with leastmean square method but was unable to get the right way for the LMS implementation.
I implemented the following considering each pulse signal has 500 samples.For the first pulse signal(of 500 samples)the reference signal is generated from the lowpass filter of the pulse signal and then using the generated error as reference noise signal for the next pulse signals
P=load('Pulse_signal.mat');
a2=P.a(334:4500,:);
for i=1:500:length(a2)-500
if(i<500)
input=a2(i:i+499,:);
detected(i:i+499,:)=input;
d = fdesign.lowpass('Fp,Fst,Ap,Ast',1.5,8,0.5,20,500);
Hd1 = design(d);
filtered = filtfilt(Hd1.Numerator,1,input);
[w,y,e,W]=simple_LMS1(filtered,input,0.08,5);
e2(i:i+499,:)=e;
y2(i:i+499,:)= y;
else
input=a2(i:i+499,:);
detected(i:i+499,:)=input;
[w,y,e,W]=simple_LMS1(e,input,0.08,8);
e2(i:i+499,:)=e;
y2(i:i+499,:)= y;
end;
end
plot(detected);hold on;plot(e2,'-r');hold on;plot(y2,'-k');
simple_LMS1 fucntion
function [w,y,e,W] = simple_LMS1(x,d,mu_step,M)
N = length(x);
y = zeros(N,1);
w = zeros(M,1);
e = zeros(N,1);
W = zeros(M,N);
for n = 1:N
if n <= M % assume zero-samples for delayed data that isn't available
k = n:-1:1;
x1 = [x(k); zeros(M-numel(k),1)];
else
x1 = x(n:-1:n-M+1); % M samples of x in reverse order
end
y(n) = w'*x1;
e(n) = d(n) - y(n);
w = w + mu_step*e(n)'*x1;
W(:,n) = w;
end
Problem: But the problem is that the output(more or less similar to input) is being alternatively shifted between the error signal and filtered signal as shown in the image below.
Can I know why this is happening.
0 个评论
回答(1 个)
Gova ReDDy
2014-1-3
6 个评论
Image Analyst
2014-1-5
When you're using a web browser and the text switches to a different color, like blue, it means that that text is a link. You can put your arrow over that blue text and it will change into a hand. Look in my comment where I put his name. See that it is in a different color? That means it's a link to the video where Doug will tell you how to solve your problem.
此问题已关闭。
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!