⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fg_09_02.m

📁 英文书《Digital Signal Processing with Examples in MATLAB》附带的MATLAB实例
💻 M
字号:
% fg_09_02    MSE contour plot w/ ideal weight track.
N=140; m=1; 
phi=cos(2*pi*[0:12]/12);
Phiff=[phi(1) phi(2); phi(2) phi(1)];
phifd=[phi(m+1); phi(m+2)];
bopt=Phiff\phifd;
fprintf('Eigenvalues:%8.4f%8.4f\n',eig(Phiff));
% Plot the contours.
db=1.99;
b0=linspace(bopt(1)-db,bopt(1)+db,N);
b1=linspace(bopt(2)-db,bopt(2)+db,N);
mse=zeros(N,N);
for i=1:N,
   for j=1:N,
      mse(i,j)=1+[b0(i) b1(j)]*Phiff*[b0(i); b1(j)]-2*[b0(i) b1(j)]*phifd;
   end
end
sp_fig(1,5,5);
set(gca,'fontsize',14);
v=[.05 .15 .4 .8 1.8 6];
[c,h]=contour(b0,b1,mse,v,'k'); grid;
clabel(c);
set(h,'linewidth',1.2);
line([bopt(1) bopt(1)],[-5 5],'color','b','linewidth',1.5);
line([-2 4],[bopt(2) bopt(2)],'color','b','linewidth',1.5);
xlabel('b_0'); ylabel('b_1');
% Plot the weight track.
b0=[1; -2.75]; u=.05; N=50;
k=[0:N-1];
b=bopt*ones(1,N)+(b0-bopt)*(1-2*u).^k;
line(b(1,:),b(2,:),'color','r','marker','o');
title('50 iterations; u=0.05.');
text(1.07,-2.8,'b(0)');
text(3.5,-.84,'c_0','fontsize',14);
text(1.8,0.8,'c_1','fontsize',14);
axis square

⌨️ 快捷键说明

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