Echo and Noise cancellation in MATLAB

44 次查看(过去 30 天)
Hi Experts!
I have a project about Echo cancelling Project and I have done some coding for designing the filters for echo cancellation. I couldn't get any help from internet.
The project says as :
The received_signal is professor's voice with noise and echo while Test Signals are just signals for sent and received.
And i have developed the following code.
Echo Canceling Project
1. Load the .mat file (serial number 33)
clear all; clc;
data=load("F33.mat");
2.Play the sound ,received_signal
%sound(data.Received_Signal,data.Fs)
% the sound was of professor with noise and echo
3. Using Test Signal , find Impulse Response.
y(n)= Received_Test_Signal
x(n)= Test_Signal
h(n)=x(n)y(n)
hn=conv(data.Received_Test_Signal,data.Test_Signal,"full");
plot(impz(hn));
title('Impulse Response of Test Signals');
Values of coefficients ai and 5001 x 1 of x(n) means it will have value of n1 to n5001.
[a]=(data.Test_Signal);
4.Recover the signal x(n)
% Using the Approach of LMS for finding the filter
d=100;
x = data.Test_Signal(d+1:end) ;% desired echo-free signal
y = data.Received_Signal(d+1:end) + 0.4*data.Received_Signal(1:end-d) ;% signal with echo
% Using LMS
M = 3*d;% FIR filter length
delta = 0.0001 ;% LMS step size
hzf = zeros(M,1);% Initial filter IR values
ev = [];
for i=M+1:length(x)
xn = x(i);% desired sample value
yn = y(i-M+1:i);
xnhat = hzf'*yn ;% filter output value
en = xn - xnhat ;% current error
hzf = hzf + delta*yn*en; % update
% Plotting
ev = [ev abs(en)];
if rem(i,100)==0 ;% too slow to plot every iteration
subplot(2,1,1);
plot(hzf);
title('Impulse response');
subplot(2,1,2);
plot(ev) ;
title('|error|');
pause(0.001);
end
end
% filtering
xn_=conv(data.Received_Signal,hzf)
z=filter(hzf,1,data.Received_Signal)
5. The zplane , for order and stability
figure(2)
zplane(hzf)
n=filtord(hzf)
% stable
isstable(hzf)
6. Structure for filter
% the filter is an IIR filter given by
figure(2)
plot(hzf)
7. IIR to FIR filter
% We have to use Window method to limit the infinite Impulse Response of
% the inverse filter. i.e hamming window method
windw=[ones(1,100)]
FIR_approx=hzf.*windw
plot(FIR_approx)
8. Applying to y(n) to remove echo
ec_removed=filter(1,FIR_approx(:),data.Received_Signal)
sound(ec_removed)
9. Plot the Recovered signal against Frequency
plot(fft2(data.Received_Signal))
xlabel('-----Frequency(Hz)--->');
10. Using fdatool , Remove noise from x(n). Serial Number =33, Using Chebyshev 1 with order 34
%recov=filter(1,FilterDesign,data.Received_Signal)
%sound(recov)

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Filter Design 的更多信息

产品


版本

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by