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!