fig811.m

来自「自适应滤波器的最陡下降法示意图」· M 代码 · 共 64 行

M
64
字号
% Figure 8.11
clear
clf
colordef(1,'white')

hopt = [1 2]';
evr = [2 1];
evr = evr.^2;
power = evr * ones(size(evr))';
evr = evr/power;
D = diag(evr);
theta = 30;
theta = theta/180*pi;
V = zeros(2,2);
V(:,1) = [cos(theta)  -sin(theta)]';
V(:,2) = [sin(theta)  cos(theta)]';
phiyy = V*D*V';

phiyx = phiyy * hopt;

NN = 50;
AA = zeros(NN,NN);
hmin = 0;
hmax = 6;
dh = (hmax-hmin)/(NN-1);
hx = hmin:dh:hmax;
hy = hx;
h = zeros(size(hopt));

% mse surface
for ii=1:NN
    for jj=1:NN
        h = [hx(ii) hy(jj)]';
        AA(ii,jj) = 1 - 2*h'*phiyx + h'*phiyy*h;
    end
end

set(gca,'FontSize',18)
%  subplot(121);
contour(hx,hy,AA,20);
axis('square');
set(gca,'FontSize',18);
xlabel('tap 0');
ylabel('tap 1');
% title('(b)')
hold on

% optimum
plot(hopt(2),hopt(1),'*')

% steepest descent
MM = 10;
h = [5,4]';
convg = zeros(2,MM);
convg(:,1) = h;
mu = 1/3;
for ii = 2:MM
    grd = 2*(phiyy*h - phiyx);
    h = h - mu * grd;
    convg(:,ii) = h;
end

plot(convg(2,:),convg(1,:),'y');
hold off

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?