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

📄 fg_08_23.m

📁 英文书《Digital Signal Processing with Examples in MATLAB》附带的MATLAB实例
💻 M
字号:
% fg_08_23     Predictive compression - waveform & residue
N=6; K=40000; L=K+N; M=1024;
% Read the signal.
fid=fopen(['signal_2.txt']);
f=fscanf(fid,'%7d%8d%8d%8d%8d%8d%8d%8d%8d%8d\n',L+5000);
fclose(fid);
f=f(5000:L+4999);
% Generate the prediction error. d(k)=s(k); f(k)=s(k-1).
d=f(1:L); f=[0; f(1:L-1)];
Rff=autocovar_mat(f,N);
rfd=crosscovar(f,d,N);
bopt=Rff\rfd;
e=d-round(filter(bopt,1,f));

w=bopt'
start=e(1:7)'

% Plot signal and prediction error after startup.
sp_fig(1,9,5.5);
set(gca,'position',[0.16 0.581098 0.775 0.343902]);
set(gca,'fontsize',16);
d=d(1:K);
line([0:K-1]/20,d,'color','r'); grid on;
ylabel('Signal d(t)');  title('T=.05 s');
set(gca,'yticklabel','-500,000|0|500,000');

axes('position',[0.16 0.11 0.775 0.343902]);
set(gca,'fontsize',16);
e=[zeros(N,1); e(N+1:K)];
line([0:K-1]/20,e,'color','b'); grid on;
ylabel('Prediction error e(t)');
xlabel('t (s)');

⌨️ 快捷键说明

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