how can i write a matlab code for lms algorithm for audio signal?

조회 수: 2 (최근 30일)
lipsa tripathy
lipsa tripathy 2017년 2월 26일
댓글: Walter Roberson 2025년 5월 18일
clc
clear all
close all
[x,Fs] = audioread('test11.wav');
sound(x,Fs);
pause(10);
delay1 = 0.6; % delay
delay2=0.9;
delay3=0.6;
alpha1 = 0.65;% echo strength
alpha2=.40;
alpha3=.5;
t=0:1/Fs:(length(x)-1)/Fs;
subplot(3,2,1)
plot(t,x)
title('original signal')
D1 = delay1*Fs;
D2=delay2*Fs;
D3=delay3*Fs;
y = zeros(size(x));
y(1:D1) = x(1:D1);
snr=4;
for i=D1+40000:length(x)
y(i) = x(i)+alpha1*x(i-D1)+alpha2*x(i-D2)+alpha3*x(i-D3);
end
sound(y,Fs);
t1=0:1/Fs:(length(y)-1)/Fs;
subplot(3,2,2)
plot(t1,y)
title('original+echo');
% -----------------------------------------------------------------
load nearspeech
load farspeech
N=100000;
L=1000;
mu=0.00003;
h1=fir1(2*L-1,0.5);
h=10*h1(L+1:2*L);
% ---------------------------------------------------------------------
wlms=zeros(L,1);
xlms=zeros(L,1);
for m=1:N
xlms=[ y(m);xlms(1:L-1) ];
ylms= h * xlms;
elms(m)= d(m) - ylms;
wlms= wlms + (mu * xlms * elms(m));
end
subplot(3,2,4)
plot(elms,'m')
title('Recovered Signal')
here only the first element of y is passing not the whole y signal.how can i make the whole y signal pass through the filter without any dimension missmatch?
  댓글 수: 3
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2025년 5월 18일
What is the variable d (not defined in your code)?
Walter Roberson
Walter Roberson 2025년 5월 18일
Presumably d is loaded through either load nearspeech or load farspeech

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Audio Processing Algorithm Design에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by