Skip to main content

MATLAB Code for Delta Modulation (DM) and Demodulation


 

MATLAB Script 

clc;
clear all;
close all;

fs = 10000;
fm = 100;
t = 0:1/fs:1000/fs; % Time Duration = 1000/10000 = 0.1 second
x = 5*sin(2*pi*100*t); % Define Message Signal with peak voltage 5V and frequency 100Hz

plot(t, x);
hold on

y = [0]; % Output DM signal i.e. stream of 1 or 0
xr = 0; % Output of Integrator i.e. staircase approximation; initial value = 0
del = 0.4; % Stepsize

for i = 1:length(x)-1
if xr(i) <= x(i) % If current sample greater than the previous values or output of the integrator, output of DM = 1
d = 1;
xr(i+1) = xr(i) + del; % Staircase approximated value
else
d = 0;
xr(i+1) = xr(i) - del; % If current sample less than the previous values or output of the integrator, output of DM = 0
end
y = [y d];
end

stairs(t, xr); % Show the staircase approximated signal
title('Staircase Approximated Signal');
hold off

MSE = sum((x - xr).^2) / length(x); % Mean Squared Error (MSE)
disp(['Mean Squared Error (MSE): ', num2str(MSE)]);

figure;

% Delta Modulation
subplot(3, 1, 1);
plot(t,y); % Show the staircase approximated signal
title('Delta Modulated Signal');

% Delta Demodulation
subplot(3, 1, 2);
y_demod = [0];
xr_demod = 0;

for i = 2:length(y)
if y(i) == 1
xr_demod = xr_demod + del;
else
xr_demod = xr_demod - del;
end
y_demod = [y_demod xr_demod];
end

plot(t, y_demod);
title('Delta Demodulated Signal (Before Filtering)');

% Apply Low-Pass Filter
filter_order = 20;
lowpass_filter = fir1(filter_order, fm/(fs/2), 'low');
filtered_demod_signal = filter(lowpass_filter, 1, y_demod);

% Plot the filtered demodulated signal
subplot(3, 1, 3);
plot(t, filtered_demod_signal);
title('Filtered Demodulated Signal');

 

Output 

 

 
 



Copy the MATLAB Code from here

 

 

 

Read more about

  1.  Pulse Amplitude Modulation (PAM) and Demodulation
  2. Pulse Width Modulation (PWM) and Demodulation
  3. Pulse Position Modulation (PPM) and Demodulation
  4. Delta Modulation and demodulation
  5. Pulse Code Modulation (PCM)
  6. Quantization Signal to Noise Ration (Q-SNR)
  7. MATLAB Code for Pulse Amplitude Modulation and Demodulation
  8. MATLAB Code for Pulse Width Modulation and Demodulation
  9. MATLAB Code for Pulse Code Modulation (PCM) and demodulation

People are good at skipping over material they already know!

View Related Topics to







Admin & Author: Salim

s

  Website: www.salimwireless.com
  Interests: Signal Processing, Telecommunication, 5G Technology, Present & Future Wireless Technologies, Digital Signal Processing, Computer Networks, Millimeter Wave Band Channel, Web Development
  Seeking an opportunity in the Teaching or Electronics & Telecommunication domains.
  Possess M.Tech in Electronic Communication Systems.


Contact Us

Name

Email *

Message *

Popular Posts

BER vs SNR for M-ary QAM, M-ary PSK, QPSK, BPSK, ...

๐Ÿ“˜ Overview of BER and SNR ๐Ÿงฎ Online Simulator for BER calculation of m-ary QAM and m-ary PSK ๐Ÿงฎ MATLAB Code for BER calculation of M-ary QAM, M-ary PSK, QPSK, BPSK, ... ๐Ÿ“š Further Reading ๐Ÿ“‚ View Other Topics on M-ary QAM, M-ary PSK, QPSK ... ๐Ÿงฎ Online Simulator for Constellation Diagram of m-ary QAM ๐Ÿงฎ Online Simulator for Constellation Diagram of m-ary PSK ๐Ÿงฎ MATLAB Code for BER calculation of ASK, FSK, and PSK ๐Ÿงฎ MATLAB Code for BER calculation of Alamouti Scheme ๐Ÿงฎ Different approaches to calculate BER vs SNR What is Bit Error Rate (BER)? The abbreviation BER stands for bit error rate, which indicates how many corrupted bits are received (after the demodulation process) compared to the total number of bits sent in a communication process. It is defined as,  In mathematics, BER = (number of bits received in error / total number of transmitted bits)  On the other hand, SNR ...

RMS Delay Spread, Excess Delay Spread and Multi-path ...

๐Ÿ“˜ Overview of Delay Spread and Multi-path ๐Ÿงฎ Excess Delay spread ๐Ÿงฎ Power delay Profile ๐Ÿงฎ RMS Delay Spread ๐Ÿ“š Further Reading ๐Ÿ“‚ Other Topics on RMS Delay Spread, Excess Delay ... ๐Ÿงฎ Multipath Components or MPCs ๐Ÿงฎ Online Simulator for Calculating RMS Delay Spread ๐Ÿงฎ Why is there significant multipath in the case of very high frequencies? ๐Ÿงฎ Why RMS Delay Spread is essential for wireless communication? ๐Ÿงฎ Why the Power Delay Profile is essential? ๐Ÿงฎ MATLAB Codes for Calculating Different Types of delay Spreads Delay Spread, Excess Delay Spread, and Multipath (MPCs) The fundamental distinction between wireless and wired connections is that in wireless connections signal reaches at receiver thru multipath signal propagation rather than directed transmission like co-axial cable. Wireless Communication has no set communication path between the transmitter and the receiver. The line...

Constellation Diagrams of ASK, PSK, and FSK

๐Ÿ“˜ Overview of Energy per Bit (Eb / N0) ๐Ÿงฎ Online Simulator for constellation diagrams of ASK, FSK, and PSK ๐Ÿงฎ Theory behind Constellation Diagrams of ASK, FSK, and PSK ๐Ÿงฎ MATLAB Codes for Constellation Diagrams of ASK, FSK, and PSK ๐Ÿ“š Further Reading ๐Ÿ“‚ Other Topics on Constellation Diagrams of ASK, PSK, and FSK ... ๐Ÿงฎ Simulator for constellation diagrams of m-ary PSK ๐Ÿงฎ Simulator for constellation diagrams of m-ary QAM BASK (Binary ASK) Modulation: Transmits one of two signals: 0 or -√Eb, where Eb​ is the energy per bit. These signals represent binary 0 and 1.    BFSK (Binary FSK) Modulation: Transmits one of two signals: +√Eb​ ( On the y-axis, the phase shift of 90 degrees with respect to the x-axis, which is also termed phase offset ) or √Eb (on x-axis), where Eb​ is the energy per bit. These signals represent binary 0 and 1.  BPSK (Binary PSK) Modulation: Transmits one of two signals...

Comparisons among ASK, PSK, and FSK | And the definitions of each

๐Ÿ“˜ Comparisons among ASK, FSK, and PSK ๐Ÿงฎ Online Simulator for calculating Bandwidth of ASK, FSK, and PSK ๐Ÿงฎ MATLAB Code for BER vs. SNR Analysis of ASK, FSK, and PSK ๐Ÿ“š Further Reading ๐Ÿ“‚ View Other Topics on Comparisons among ASK, PSK, and FSK ... ๐Ÿงฎ Comparisons of Noise Sensitivity, Bandwidth, Complexity, etc. ๐Ÿงฎ MATLAB Code for Constellation Diagrams of ASK, FSK, and PSK ๐Ÿงฎ Online Simulator for ASK, FSK, and PSK Generation ๐Ÿงฎ Online Simulator for ASK, FSK, and PSK Constellation ๐Ÿงฎ Some Questions and Answers Modulation ASK, FSK & PSK Constellation MATLAB Simulink MATLAB Code Comparisons among ASK, PSK, and FSK    Comparisons among ASK, PSK, and FSK   Simulator for Calculating Bandwidth of ASK, FSK, and PSK The baud rate represents the number of symbols transmitted per second. Both baud rate and bit rate a...

MATLAB Code for Pulse Amplitude Modulation (PAM) and Demodulation

๐Ÿ“˜ Overview & Theory of Pulse Amplitude Moduation (PAM) ๐Ÿงฎ MATLAB Code for Pulse Amplitude Modulation and Demodulation of Analog Signal and Digital Signal ๐Ÿงฎ Simulation results for comparison of PAM, PWM, PPM, DM, and PCM ๐Ÿ“š Further Reading ๐Ÿ“‚ Other Topics on Pulse Amplitude Modulation ... ๐Ÿงฎ MATLAB Code for Pulse Amplitude Modulation and Demodulation of an Analog Signal (2) ๐Ÿงฎ MATLAB Code for Pulse Amplitude Modulation and Demodulation of Digital data ๐Ÿงฎ Other Pulse Modulation Techniques (e.g., PWM, PPM, DM, and PCM)   Pulse Amplitude Modulation (PAM) & Demodulation of an Analog Message Signal MATLAB Script clc; clear all; close all; fm= 10; % frequency of the message signal fc= 100; % frequency of the carrier signal fs=1000*fm; % (=100KHz) sampling frequency (where 1000 is the upsampling factor) t=0:1/fs:1; % sampling rate of (1/fs = 100 kHz) m=1*cos(2*pi*fm*t); % Message signal with per...

Difference between AWGN and Rayleigh Fading

๐Ÿ“˜ Introduction, AWGN, and Rayleigh Fading ๐Ÿงฎ Simulator for the effect of AWGN and Rayleigh Fading on a BPSK Signal ๐Ÿงฎ MATLAB Codes ๐Ÿ“š Further Reading Wireless Signal Processing Gaussian and Rayleigh Distribution Difference between AWGN and Rayleigh Fading 1. Introduction Rayleigh fading coefficients and AWGN, or additive white gaussian noise [↗] , are two distinct factors that affect a wireless communication channel. In mathematics, we can express it in that way.  Fig: Rayleigh Fading due to multi-paths Let's explore wireless communication under two common noise scenarios: AWGN (Additive White Gaussian Noise) and Rayleigh fading. y = h*x + n ... (i) Symbol '*' represents convolution. The transmitted signal  x  is multiplied by the channel coefficient or channel impulse response (h)  in the equation above, and the symbol  "n"  stands for the white Gaussian noise that is added to the si...

MATLAB Codes for Various types of beamforming | Beam Steering, Digital...

๐Ÿ“˜ How Beamforming Improves SNR ๐Ÿงฎ MATLAB Code ๐Ÿ“š Further Reading ๐Ÿ“‚ Other Topics on Beamforming in MATLAB ... MIMO / Massive MIMO Beamforming Techniques Beamforming Techniques MATLAB Codes for Beamforming... How Beamforming Improves SNR The mathematical [↗] and theoretical aspects of beamforming [↗] have already been covered. We'll talk about coding in MATLAB in this tutorial so that you may generate results for different beamforming approaches. Let's go right to the content of the article. In analog beamforming, certain codebooks are employed on the TX and RX sides to select the best beam pairs. Because of their beamforming gains, communication created through the strongest beams from both the TX and RX side enhances spectrum efficiency. Additionally, beamforming gain directly impacts SNR improvement. Wireless communication system capacity = bandwidth*log2(1+SNR)...

Mathematical Aspects of Beamforming in MIMO

๐Ÿ“˜ Overview ๐Ÿงฎ The Mathematics Behind Analog, Digital, and Hybrid Beamforming ๐Ÿ“š Further Reading ๐Ÿ“‚ Other Topics on Beamforming in MIMO ... MIMO / Massive MIMO Beamforming Techniques Beam steering, which permits strong directed beams towards the receiver to combat excessive pathloss, especially for higher frequency bands, immediately comes to mind when discussing mathematical aspects of Beamforming in MIMO antennas. On the other side, it also lessens signal interference and improves the effectiveness of spatial multiplexing in Massive MIMO communication. Let's go right to the mathematical parts of Beamforming, which will make it easier for you to code in Python and MATLAB. 1. Beam Steering (Analog Beamforming) In the first stage, the BS applies beam steering at the side of the mobile station (MS) while the MS enables omnidirectional transmission. In the following step, the MS uses beam steering while the BS is an...