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

📄 dpcm_demo.m

📁 dpcm matlab code in zip format
💻 M
字号:

close all
clear
% signal sampling
fs=1/2000;
tn=0:fs:1/25;
%SELECT A SIGNAL ****************************
s=.5*sin(2*pi*50*tn);
%[s,fs]=wavread('bye441');  %read .wav file

%lpc and encoder-decoder parameters
lpclen=20;
bitsize=input('bitsize=');
fprintf('\nPlease wait... data length is %i\n',length(s))
%LPF parameters
tap=100;
cf=.15;

% DPCM with predictor
[Q,b, ai] = dpcm_enco_lpc(s, lpclen, bitsize);
[st]=dpcm_deco_lpc(b, ai, bitsize);
Sa=LPF(tap,cf,st);
%[xa,ya]=stairs(tn,Sa);

figure
subplot(3,1,1):plot(s,'r');
ylabel('amplitude');
title('DPCM with predictor (red:input, green:decoder output, blue: LPF output)');
subplot(3,1,2):plot(st,'g');
ylabel('amplitude');
subplot(3,1,3):plot(Sa,'b');
ylabel('amplitude');
xlabel('index, n');
grid

%fprintf('\npress a key to hear input\n\n');
%pause%sound(s,fs);
%fprintf('press a key to hear LPF output\n\n');
%pause%sound(Sa,fs);

⌨️ 快捷键说明

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