📄 main2.m
字号:
clear allu = rand(1000,1);W = [1 2 3]'d = filter(flipud(W),1,u);[row,col]=size(u);r = xcorr(u,2); % Calculate (k)th autocorrelation and accumulatep = xcorr(d,u,2); % Calculate (k)th cross correlation and accumulateR = toeplitz(r(2+1:2*(2+1)-1))/(row*col) % (L x L) input autocorrelation matrixp = p(2+1:2*(2+1)-1)/(row*col) N=length(u);winit=[0;0];mu=0.05;wo=inv(R)*p;Jmin=mean(d.^2)-W'*pw1=[wo(1):1:(wo(1)+2)];w2=[wo(2):1:(wo(2)+2)];Jm = jmat(w1,w2,R,p,Jmin);[w,J]=sd(mu,winit,N,R,p,Jmin);[MSE,wm]=lms(mu,5,u,d);figure(2)contour(w1,w2,Jm',50);xlabel('w1');ylabel('w2');hold onplot(w(1,:),w(2,:),'-O');gridplot(wm(1,:),wm(2,:),'-x');gridhold offfigure(3)plot(J);grid on;xlabel('No. of Itterations');ylabel('MSE');title('Steepest Descent');figure(4)plot(MSE);grid on;xlabel('No. of Itterations');ylabel('MSE');title('LMS');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -