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

📄 dm_demo.m

📁 By using a MATLAB program, design a Delta Modulation (DM) system with one step-size and a modified D
💻 M
字号:
%Sample demo for Delta modulation

close all
clear
% signal sampling
fs=1/2000;
tn=0:fs:1/25;
%Example1 ****************************
s=.5*sin(2*pi*50*tn);

% Delta modulation-demodulation
StepSize=1/15;
%encoder
cn=dm_encoder(s, StepSize);
%decoder
[Sn]=dm_decoder(StepSize,fs, cn);
%lowpass filter
Sa=lpf(100, .1, Sn);

%plot the input and accumulator output 
subplot(3,1,1):plot(s,'r');
grid on
title('DM (red:input signal, green:decoder output, blue: LPF output)');
ylabel('amplitude');
subplot(3,1,2):plot(Sn,'g');
grid on
ylabel('amplitude');
subplot(3,1,3):plot(Sa,'b');
grid on 
xlabel('index, n');
ylabel('amplitude');

%example2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure
[s,fs]=wavread('bye441');  %read .wav file
% Delta modulation-demodulation
StepSize=1/15;
%encoder
cn=dm_encoder(s, StepSize);
%decoder
[Sn]=dm_decoder(StepSize,fs, cn);
%lowpass filter
Sa=lpf(100, .1, Sn);

%plot the input and accumulator output 
subplot(3,1,1):plot(s,'r');
grid on
title('DM (red:input signal, green:decoder output, blue: LPF output)');
ylabel('amplitude');
subplot(3,1,2):plot(Sn,'g');
grid on
ylabel('amplitude');
subplot(3,1,3):plot(Sa,'b');
grid on 
xlabel('index, n');
ylabel('amplitude');

sound(Sa,fs);

⌨️ 快捷键说明

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