Can someone explain why the error and filtered are switching alternatively after each iteration. Is there something wrong with the code itself .
Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
Can someone explain why the error and filtered signals are switching alternatively.
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposte (1)
Gova ReDDy
il 3 Gen 2014
6 Commenti
Image Analyst
il 5 Gen 2014
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.
Questa domanda è chiusa.
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!