内容发布更新时间 : 2024/12/24 7:14:56星期一 下面是文章的全部内容请认真阅读。
实用标准文档
4.仿真题4.18
仿真结果及图形:
步长为0.05时失调参数为m1=0.0493; 步长为0.005时失调参数为m2=0.0047。
图 6 步长为0.05时权向量的收敛曲线
图 7 步长为0.005时权向量的收敛曲线
文案大全
实用标准文档
图 8 步长分别为0.05和0.005时100次独立实验的学习曲线
仿真程序(4_18):
clear all clc
%% 产生100组独立样本序列 data_len=512; trials=100; n=1:data_len; a1=-0.975; a2=0.95; sigma_v_2=0.0731;
v=sqrt(sigma_v_2)*randn(data_len,1,trials); u0=[0 0]; num=1; den=[1,a1,a2]; Zi=filtic(num,den,u0);
u=filter(num,den,v,Zi); %产生100组独立信号 %% LMS迭代 mu1=0.05;mu2=0.005;
w1=zeros(2,data_len,trials); w2=w1; for m=1:100;
temp=zeros(data_len,1);
e1(:,:,m)=temp;e2(:,:,m)=temp;d1(:,:,m)=temp;d2(:,:,m)=temp; for n=3:data_len-1
文案大全
实用标准文档
w1(:,n+1,m)=w1(:,n,m)+mu1*u(n-1:-1:n-2,:,m)*conj(e1(n,1,m)); w2(:,n+1,m)=w2(:,n,m)+mu2*u(n-1:-1:n-2,:,m)*conj(e2(n,1,m)); d1(n+1,1,m)=w1(:,n+1,m)'*u(n:-1:n-1,:,m); d2(n+1,1,m)=w2(:,n+1,m)'*u(n:-1:n-1,:,m); e1(n+1,1,m)=u(n+1,:,m)-d1(n+1,1,m); e2(n+1,1,m)=u(n+1,:,m)-d2(n+1,1,m); end end
t=1:data_len;
w1_mean=zeros(2,data_len);
w2_mean=w1_mean;e1_mean=zeros(data_len,1);e2_mean=e1_mean; for m=1:100
w1_mean=w1_mean+w1(:,:,m); w2_mean=w2_mean+w2(:,:,m); e1_mean=e1_mean+e1(:,:,m).^2; e2_mean=e2_mean+e2(:,:,m).^2; end
w1_mean=w1_mean/100; 0次独立实验权向量的均值 w2_mean=w2_mean/100;
e1_100trials_ave=e1_mean/100; 0次独立实验的学习曲线均值 e2_100trials_ave=e2_mean/100; figure(1)
plot(t,w1(1,:,90),t,w1(2,:,90),t,w1_mean(1,:),t,w1_mean(2,:)) xlabel('迭代次数');ylabel('权向量') title('步长=0.05') figure(2)
plot(t,w2(1,:,90),t,w2(2,:,90),t,w2_mean(1,:),t,w2_mean(2,:)) xlabel('迭代次数');ylabel('权向量') title('步长=0.005')
%% 计算剩余误差和失调参数 wopt=zeros(2,trials); Jmin=zeros(1,trials); sum_eig=zeros(trials,1); for m=1:trials
rm=xcorr(u(:,:,m),'biased'); R=[rm(512),rm(513);rm(511),rm(512)]; p=[rm(511);rm(510)]; wopt(:,m)=R\\p; [v,d]=eig(R);
Jmin(m)=rm(512)-p'*wopt(:,m); sum_eig(m)=d(1,1)+d(2,2); end
sJmin=sum(Jmin)/trials;
文案大全
实用标准文档
Jex1=e1_100trials_ave-sJmin; %剩余均方误差mu1 Jex2=e2_100trials_ave-sJmin; %剩余均方误差mu2 sum_eig_100trials=sum(sum_eig)/100;
Jexfin1=mu1*sJmin*(sum_eig_100trials/(2-mu1*sum_eig_100trials)); Jexfin2=mu2*sJmin*(sum_eig_100trials/(2-mu2*sum_eig_100trials)); M1=Jexfin1/sJmin; %失调参数m1 M2=Jexfin2/sJmin; %失调参数m2 figure(3)
plot(t,e1_100trials_ave,'*',t,e2_100trials_ave) xlabel('迭代次数');ylabel('均方误差') legend('u1=0.05','u2=0.005') axis([0,600,0,1])
文案大全