資源簡介
RLS和LMS自適應(yīng)濾波器的性能對比,代碼在MATLAB中完美運行。

代碼片段和文件信息
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%LMS自適應(yīng)濾波器性能分析?
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear?
clc
close?all
%%%%%%%%%%%%%%參數(shù)設(shè)置%%%%%%%%%%%%%%%%%%%%%%%
w=3.2;
step_len=0.075;
variance_v=0.001;
repeat_times=200;
iteration_times=500;
filt_len=2;
delay=fix(filt_len/2)-1;
%%%%%%%%%%%%%%%%%%%%變量及數(shù)組初始化%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chan_factor=(1+cos(2*pi*([1:1:3]-2)/w))/2;
Square_err=zeros(repeat_timesiteration_times);
%%%%%%%%%%%%%外循環(huán),重復(fù)做repeat_timws次實驗,平均值%%%%%%%%%%%%%%%%
for?loop1=1:repeat_times
%%%%%%%%%%%%%%內(nèi)循環(huán)變量及數(shù)組初始化%%%%%%%%%%%%%%%%%%%%%%%%
Source=zeros(iteration_times1);
W=zeros(filt_len1);
%%%%%%%%%%%%%內(nèi)循環(huán),做iteration_times次迭代%%%%%%%%%%%%%%%%%%%%%%%%%%%%
???for?i=1:iteration_times
%%%%%%%%%%%%%%信源,產(chǎn)生等概率分布的正負(fù)1%%%%%%%%%%%%%%%%%%%%%%%%%%%%
??????if?rand<0.5
??????????Source(i)=-1;
??????else
??????????Source(i)=1;
??????end
???end
%%%%%%%%%%%%%%信道,濾波和加噪聲%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
???Revdata=filter(Chan_factor1Source)+randn(iteration_times1)*sqrt(variance_v);
%%%%%%%%%%%%%%均衡器,基于LMS算法%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%????
????for?loop2=1:iteration_times-filt_len+1
????????U=Revdata(loop2:loop2+filt_len-1);
????????d=Source(loop2+delay);
????????
????????e=d-W‘*U;
????????W=W+step_len*U*e;
????????
????????Square_err(loop1loop2)=e.^2;
????end
end
%%%%%%%%%%%%%%作圖,顯示結(jié)果%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Square_err_mean=sum(Square_err(::))/repeat_times;
semilogy(Square_err_mean);
figure(2);
stem(W);
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????1586??2008-01-10?05:07??RLS與LMS算法分析及比較\.m
?????文件???????1749??2007-12-23?22:36??RLS與LMS算法分析及比較\RLSnew.m
?????文件????????736??2017-06-10?20:26??RLS與LMS算法分析及比較\rls_lms.m
?????目錄??????????0??2017-09-13?14:16??RLS與LMS算法分析及比較
-----------?---------??----------?-----??----
?????????????????4071????????????????????4
評論
共有 條評論