📄 main.asv
字号:
clear allN=2;u = rand(3000,1);W = [1 2]';d = filter(flipud(W),1,u);[row,col]=size(u);r = xcorr(u,N); % Calculate (k)th autocorrelation and accumulatep = xcorr(d,u,N); % Calculate (k)th cross correlation and accumulateR = toeplitz(r(N+1:2*(N+1)-1))/(row*col) % (L x L) input autocorrelation matrixP = p(N+1:2*(N+1)-1)/(row*col) winit=[0;0];Jmin=mean(d.*d) - p'*inv(R)*p;mu=0.01;wo=R\p;w1=[(wo(1)-7):0.1:(wo(1)+7)];w2=[(wo(2)-7):0.1:(wo(2)+7)];Jm = jmat(w1,w2,R,p,Jmin);[w,J]=sd(mu,winit,N,R,p,Jmin);[e,wm]=lms(mu,N,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 off%figure(2)%plot(J);grid on;xlabel('No. of Itterations');ylabel('MSE');title('Steepest Descent');%figure(3)%plot(Jn);xlabel('No. of Itterations');ylabel('MSE');title('Newtons Method');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -