Clear Filters
Clear Filters

mse for lms - learning curves please help

4 views (last 30 days)
yuval ohayon
yuval ohayon on 23 Dec 2018
Reopened: yuval ohayon on 23 Dec 2018
hi iv written a code for lms algorithem and i want to add some learning curves..the error as a mu function,the mse error for several ittiration,someone can help ..?it random proccecing logic..
M=4001 %%%number of samples
fs=8000 %%%%hz
[B,A]=cheby2(4,20,[0.1 0.7 ]);%%%מקדמי פונקציית התמסורת
tf=dfilt.df2t([zeros(1,6) B],A);%%%padding 6 more zeros for shrink the signal (1 sample is now bigger 6 samples of before)
%%%%נדמה רעש אקראי ש'יכול להיגרם בכל חדר טיפוסי.מקלדת אנשים שהולכים אותות
%קופ ם מהקיר.ונשתמש בפוקציה פילטר שמנקה את האות מאותו גורם הרעשתבמישור
%הזמן ניתן לראות את הדעיכה שמאופיינת מרעש אקראי שנוצר בחדר.
H_ROOM=filter(tf,log(0.99*rand(1,M)+0.01).*sign(randn(1,M)).*exp(-0.002*(1:M))) ;
H_ROOM=H_ROOM/norm(H_ROOM) *4; %%%הכפלה ב4 על מנת שנוכל לראות את האות
t1=(0:M-1)*(1/fs);
figure(1);
plot(t1,H_ROOM);
xlim([0 0.25]);
xlabel('Time[sec]');
ylabel('amplitude');
title('Room Impluse response-padding 6 zeros');
%%%%נטען קובץ בנוי ממאטלאב כאות שמדבר האיש אל המיקרופון
load farspeech
x=x(1:length(x));%%%%להכניס את הקובץ אל משתנה בעל דגימות שבגודל הוקטור הדגום
echoed_signal=filter(H_ROOM,1,x); %%%% the far speach is with vibration,when we filtered it with the transfer function of the room impulse respone we visualize an echoed signal
%יש צורך לדמות את הקול שמועבר כדי לקבל סימלוציה שמתקרבת למציאות,האות שעובר
%מהמיקרופון עם רעשי הרקע הוא הוא האות המהודהד
%%הגבר ודחיסה לאות.
load nearspeech
v=v(1:length(v))
;%ה הקול המהודהד של האיש הראשון פלו רעשי רקע קטנים
n=(1:2680)
for i=1:2680
echoed_signal_new(i)=10.*echoed_signal(i*100) %%%%%%gain for seeing results
new_x(i)=10.*x(i*100)
person_2(i)=10.*v(i*100)
end
%%%%%lms algorithem
total_signal=echoed_signal_new+person_2+0.001*rand(1,length(n)) %%additional noise
w=zeros(1,length(n))
mu=input('mu please')
for i=1:length(n)
e(i)=total_signal(i)-w(i)'*new_x(i)
y_desired(i)=sum(w(i)'*new_x(i))
cost(i)=e(i)*e(i)
w(i+1)=w(i)+mu*e(i)*new_x(i) %%%determing coefficients
end
for i=1:length(n)
mse(i)=mean(abs(total_signal(i)-y_desired(i)).^2)
end
figure(5)
subplot(5,1,1)
plot(n,new_x(n))
title('desired signal')
xlim([0 2680])
subplot(5,1,2)
plot(n,person_2(n))
title('person 2 voice ')
xlabel('samples')
ylabel('amplitude')
xlim([0 2680])
subplot(5,1,3)
plot(n,total_signal(n))
title('echoed+ person2 and noise from transmition line and noise room')
xlim([0 2680])
ylim([-2 2])
subplot(5,1,4)
plot(mse)
title('mse error amplitude ')
xlabel('itterations')
ylabel('error value')
xlim([0 2680])
subplot(5,1,5)
plot(n,y_desired(n))
title('estimated adaptive output')
xlim([0 2680])
ylim([-2 2])
figure(6)
plot(n,w(n))
title('wight function')
xlim([0 2680])
  3 Comments
yuval ohayon
yuval ohayon on 23 Dec 2018
how i get rid of the blank data??
what is tool ribbon?
the cut the samples to 2680 instead 268000
yuval ohayon
yuval ohayon on 23 Dec 2018
no whats hppens is the vector get much smaller

Sign in to comment.

Answers (1)

yuval ohayon
yuval ohayon on 23 Dec 2018
Edited: madhan ravi on 23 Dec 2018
M=4001 %%%number of samples
fs=8000 %%%%hz
[B,A]=cheby2(4,20,[0.1 0.7 ]);%%%מקדמי פונקציית התמסורת
tf=dfilt.df2t([zeros(1,6) B],A);%%%padding 6 more zeros for shrink the signal (1 sample is now bigger 6 samples of before)
%%%%נדמה רעש אקראי ש'יכול להיגרם בכל חדר טיפוסי.מקלדת אנשים שהולכים אותות
%קופ ם מהקיר.ונשתמש בפוקציה פילטר שמנקה את האות מאותו גורם הרעשתבמישור
%הזמן ניתן לראות את הדעיכה שמאופיינת מרעש אקראי שנוצר בחדר.
H_ROOM=filter(tf,log(0.99*rand(1,M)+0.01).*sign(randn(1,M)).*exp(-0.002*(1:M))) ;
H_ROOM=H_ROOM/norm(H_ROOM) *4; %%%הכפלה ב4 על מנת שנוכל לראות את האות
t1=(0:M-1)*(1/fs);
figure(1);
plot(t1,H_ROOM);
xlim([0 0.25]);
xlabel('Time[sec]');
ylabel('amplitude');
title('Room Impluse response-padding 6 zeros');
%%%%נטען קובץ בנוי ממאטלאב כאות שמדבר האיש אל המיקרופון
load farspeech
x=x(1:length(x));%%%%להכניס את הקובץ אל משתנה בעל דגימות שבגודל הוקטור הדגום
echoed_signal=filter(H_ROOM,1,x); %%%% the far speach is with vibration,when we filtered it with the transfer function of the room impulse respone we visualize an echoed signal
%יש צורך לדמות את הקול שמועבר כדי לקבל סימלוציה שמתקרבת למציאות,האות שעובר
%מהמיקרופון עם רעשי הרקע הוא הוא האות המהודהד
%%הגבר ודחיסה לאות.
load nearspeech
v=v(1:length(v))
;%ה הקול המהודהד של האיש הראשון פלו רעשי רקע קטנים
n=(1:2680)
for i=1:2680
echoed_signal_new(i)=10.*echoed_signal(i*100) %%%%%%gain for seeing results
new_x(i)=10.*x(i*100)
person_2(i)=10.*v(i*100)
end
%%%%%lms algorithem
total_signal=echoed_signal_new+person_2+0.001*rand(1,length(n)) %%additional noise
w=zeros(1,length(n))
mu=input('mu please')
for i=1:length(n)
e(i)=total_signal(i)-w(i)'*new_x(i)
y_desired(i)=sum(w(i)'*new_x(i))
w(i+1)=w(i)+mu*e(i)*new_x(i) %%%determing coefficients
end
for i=1:length(n)
mse(i)=mean(abs(total_signal(i)-y_desired(i)).^2)
end
figure(5)
subplot(5,1,1)
plot(n,new_x(n))
title('desired signal')
xlim([0 2680])
subplot(5,1,2)
plot(n,person_2(n))
title('person 2 voice ')
xlabel('samples')
ylabel('amplitude')
xlim([0 2680])
ylim([-10 10])
subplot(5,1,3)
plot(n,total_signal(n))
title('echoed+ person2 and noise from transmition line and noise room')
xlim([0 2680])
ylim([-2 2])
subplot(5,1,4)
plot(n,e(n))
title(' error amplitude ')
xlabel('itterations')
ylabel('error value')
xlim([0 2680])
ylim([-10 10])
subplot(5,1,5)
plot(n,y_desired(n))
title('estimated adaptive output')
xlim([0 2680])
ylim([-2 2])
figure(6)
plot(n,w(n))
title('wight function')
xlim([0 2680])
%

Categories

Find more on Mathematics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!