Hi. I am trying to create a loop for adaptive feedback cancellation. While the code runs without an error, i am not getting any output. Can anyone please help correct my mistake? Thank you in advance :)
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
[x,f,nbit]=wavread('tapestry.wav');
fb=zeros(length(x),1); %feedback signal, output of original feedback path F(k)
y=zeros(length(x),1);y(1)=x(1); %mic input
v=zeros(length(x),1); %adaptive filter input
u=zeros(length(x),1);u(1)=5*x(1)%loudspeaker signal initialized when there's no feedback signal at the start
e=zeros(length(x),1);e(1)=x(1); %error signal, i.e. e(n) = y(n)-v(n)
F=dsp.DigitalFilter; %original feedback path F(k), FIR filter of order 50
F.TransferFunction='Fir (all zeros)';
F.Numerator=fir1(50,[0.5,0.75]);
F.FrameBasedProcessing=false; %enables sample-by-sample processing
%fvtool(F.Numerator,1); %displays magnitude response of F(k)
AF=dsp.LMSFilter;
AF.Method='Normalized LMS';
AF.Length=50;
AF.StepSize=0.002;
for i=2:length(x)
fb(i)=step(F,u(i-1));
[v(i),err,wts]=step(AF,u(i-1),fb(i-1));
y(i)=x(i)+fb(i);
e(i)=y(i)-v(i);
u(i)=5*e(i);
end
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Adaptive Filters dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!