91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 2KB
    文件類型: .rar
    金幣: 2
    下載: 1 次
    發布日期: 2021-08-10
  • 語言: Matlab
  • 標簽: LMSRLS??

資源簡介

基于MATLAB的LMS和RLS算法濾波完整程序,一種是LMS算法,一種是RLS算法,并在MATLAB環境下對其進行了編程.對自適應濾波器性能進行分析

資源截圖

代碼片段和文件信息


%LMS自適應濾波器性能分析?
clear?
clc
close?all
%%%%%%%%%%%%%%參數設置%%%%%%%%%%%%%%%%%%%%%%%
w=3;
%?step_len=0.075;%步長
step_len=0.05;%步長

variance_v=0.01;%方差
repeat_times=20;%重復次數
iteration_times=500;%迭代次數
filt_len=2;%濾波器長度
delay=fix(filt_len/2)-1;
delay1=1;



%%%%%%%%%%%%%%%%%%%%變量及數組初始化%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Chan_factor=(1+cos(2*pi*([1:1:3]-2)/w))/2
Square_err=zeros(repeat_timesiteration_times);
%?Chan_factor1=[-0.195?0.95]
Chan_factor1=[-0.195?0.95]
X=zeros(filt_len1);
W1=[];
W2=[];
Wm1=[repeat_timesiteration_times];
Wm2=[repeat_timesiteration_times];


%%%%%%%%%%%%%外循環,重復做repeat_timws次實驗,平均值%%%%%%%%%%%%%%%%

for?loop1=1:repeat_times%循環次數
????
%%%%%%%%%%%%%%內循環變量及數組初始化%%%%%%%%%%%%%%%%%%%%%%%%
Source=zeros(iteration_times1);
W=zeros(filt_len1);

%%%%%%%%%%%%%內循環,做iteration_times次迭代%%%%%%%%%%%%%%%%%%%%%%%%%%%%
???for?i=1:iteration_times
%%%%%%%%%%%%%%信源,產生等概率分布的正負1%%%%%%%%%%%%%%%%%%%%%%%%%%%%
??????if?rand<0.5
??????????Source(i)=-1;
??????else
??????????Source(i)=1;
??????end
???end
%%%%%%%%%%%%%%信道,濾波和加噪聲%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
?Revdata=filter(Chan_factor11Source)+randn(iteration_times1)*sqrt(variance_v);
%??Revdata=filter(Chan_factor1Source)+randn(iteration_times1)*sqrt(variance_v);??
%????Revdata=filter(Chan_factor11Source);
???
%?RT=filter(Chan_factor11Source);
%%%%%%%%%%%%%%均衡器,基于LMS算法%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%????
????for?loop2=1:iteration_times-filt_len+1
????????
%?????????U=Revdata(loop2:loop2+filt_len-1);
%??????????y(n)=W‘*U=W‘*x(n)U=x(n)=輸入
%??????????d為輸出
????????U=Source(loop2:loop2+filt_len-1);
????????d=Revdata(loop2+1);
%?????????d=Source(loop2+delay);
%?????????X=?x(3)=v(3)-a1*x(2)-a2*x(1);
????????
%???????????d=RT(loop2+delay1);
%?????????Y(loop2)=W‘*U;
????????e=d-W‘*U;
%?????????e=d-W‘*U;
????????W=W+step_len*U*e;
????????
????????Wm1(loop2loop1)=W(1);
????????Wm2(loop2loop1)=W(2);
%?????????W1(loop2)=W(1);
%?????????W2(loop2)=W(2);
????????Square_err(loop1loop2)=e.^2;
????end
????
????
end



%%%%%%%%%%%%%%作圖,顯示結果%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Square_err_mean=sum(Square_err(::))/repeat_times;
%?Wm2
W1=Wm1(:repeat_times);
W2=Wm2(:repeat_times);
meanW1=mean(Wm1‘);
meanW2=mean(Wm2‘);
Square_err;
%semilogy(Square_err_mean);
figure(1);
plot(Square_err_mean);
hold?on;
plot(Square_err(1:)‘r‘);
legend(‘20次重復試驗平均誤差‘‘單次誤差‘);
xlabel(‘迭代次數‘);
ylabel(‘均方誤差‘);
title(‘步長為0.075,500次迭代均方誤差變化曲線‘);
grid?on;
hold?on;

figure(2);
plot(W1);
hold?on;
plot(W2‘r‘);
hold?on;
plot(meanW1‘k‘);
hold?on;
plot(meanW2‘--k‘);
legend(‘W1‘‘W2‘‘20次重復試驗W1‘‘20次重復試驗W2‘);
xlabel(‘迭代次數‘);
ylabel(‘抽頭權值‘);
title(‘步長為0.075,500次迭代權值學習曲線‘);
grid?on;


?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件???????2939??2017-12-17?16:08??LMS濾波程序.m

?????文件???????2731??2017-12-17?16:09??RLS濾波程序.m

-----------?---------??----------?-----??----

?????????????????5670????????????????????2


評論

共有 條評論

相關資源