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 (최근 30일)
이전 댓글 표시
[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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Adaptive Filters에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!