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

📄 fg_08_21.m

📁 英文书《Digital Signal Processing with Examples in MATLAB》附带的MATLAB实例
💻 M
字号:
% fg_08_21          Noise cancelling - s+n and s hat.
K=40000; T=1/40000;
% Copy the speech signal.
fid=fopen(['signal_3.txt']);
s=fscanf(fid,'%7d%8d%8d%8d%8d%8d%8d%8d%8d%8d\n',K);
fclose(fid);
s=127*s'/max(abs(s));
% Generate the rock drill noise.
b=[1 zeros(1,99) -.99];
a=[1 -2*.99*cos(2*pi*2/100) .99^2];
randn('seed',0);
n=filter(b,a,10*rand(1,40000));
% Generate the corellated noise.
theta=[0 3 4 5 6];
zer=.9*[exp(j*theta) exp(-j*theta)];
f=.01*filter(1,poly(zer),n);

% Plot s+n and e.
sp_fig(1);
subplot(4,1,1);
set(gca,'fontsize',16);
line([0:K-1]*T,s+n,'color','k'); grid on;
axis([0 1 -500 500]);
ylabel('s(t)+n(t)');

subplot(4,1,2); N=5;
set(gca,'fontsize',16);
Rff=autocovar_mat(f,N);
rfd=crosscovar(f,s+n,N);
b=Rff\rfd;
e=s+n-filter(b,1,f);
line([0:K-1]*T,e,'color','k'); grid on;
axis([0 1 -150 150]);
ylabel('e(t); N=5');

subplot(4,1,3); N=12;
set(gca,'fontsize',16);
Rff=autocovar_mat(f,N);
rfd=crosscovar(f,s+n,N);
b=Rff\rfd;
e=s+n-filter(b,1,f);
line([0:K-1]*T,e,'color','k'); grid on;
axis([0 1 -150 150]);
ylabel('e(t); N=12');

subplot(4,1,4);
set(gca,'fontsize',16);
line([0:K-1]*T,s,'color','k'); grid on;
axis([0 1 -150 150]);
xlabel('t (s)'); ylabel('s(t)');

⌨️ 快捷键说明

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