Professional Documents
Culture Documents
MODULATION
Pranav Gandhi 142207005
DELTA MODULATION
CODE:-
A = 10;
del = 0.5;
% Generate a sinusoidal signal
t = 0:2*pi/100:2*pi;
x = A * sin(t);
% Initialize variables
y = [0];
xr = 0;
demodulated_signal = [xr];
% Modulation
for i = 1:length(x) - 1
if xr <= x(i)
d = 1;
xr = xr + del;
else
d = 0;
xr = xr - del;
end
y = [y d];
% Store the demodulated signal at each step
demodulated_signal = [demodulated_signal xr];
end
% Calculate Mean Squared Error (MSE)
MSE = sum((x - demodulated_signal).^2) / length(x);
% Create a figure with a larger size
figure('Position', [100, 100, 800, 600]);
% Original Signal
subplot(4, 1, 1);
plot(t, x);
title('Original Signal');
ylim([-A-1, A+1]);
% Modulated Output
subplot(4, 1, 2);
stairs(y);
title('Modulated Output');
ylim([-0.5, 1.5]);
% Step Output
subplot(4, 1, 3);
stairs(demodulated_signal);
title('Step Output');
ylim([-A-1, A+1]);
% Regenerated (Demodulated) Signal
subplot(4, 1, 4);
plot(t, demodulated_signal(1:length(x)));
title('Regenerated (Demodulated) Signal');
ylim([-A-1, A+1]);
sgtitle('Delta Modulation');
end
OUTPUT:
Granular Noise
Adaptive Delta Modulation:
Code:
% Example input parameters
A = 10; % Amplitude of the input sinusoidal signal
Delta = 0.5; % Initial step size
td = 1/(2*pi*10000); % Original sampling period of the input signal (assuming
1000 Hz)
ts = 2*td; % Required sampling period for ADM output (an integral multiple
of td)
% Initialize outputs
ADMout = zeros(1, Lsig_in * Nfac);
MODout = zeros(1, Lsig_in * Nfac);
STEPout = zeros(1, Lsig_in * Nfac);
DEMout = zeros(1, Lsig_in * Nfac);
% Display
figure;
% Original Signal
subplot(3, 1, 1);
plot(sig_in);
xlim([0 350]);
title('Original Signal');
% Modulated Output
subplot(3, 1, 2);
stairs(MODout); % Use stairs for pulse-like modulated output
xlim([0 350]);
title('Modulated Output');
% Step Output
%subplot(3, 1, 3);
%stairs(STEPout); % Use stairs for staircase step output
%xlim([0 70]);
%title('Step Output');
% Demodulated Output
subplot(3, 1, 3);
plot(DEMout);
xlim([0 350]);
title('Demodulated Output');
Output:
Results:
Delta Modulation (DM) Results:
Delta Modulation (DM) involves the modulation of a continuous input signal using a fixed step size
(Δ). In our experiments, a sampling frequency of 10,000 Hz was used. The DM-modulated signal
exhibited a pulse-like waveform with each pulse corresponding to a change in the input signal's
amplitude. The step size (Δ) remained constant throughout, resulting in quantization errors when the
input signal varied rapidly. The step output of DM displayed variations in step size as it attempted to
track the input signal. The step size increased when the input signal's amplitude rose abruptly and
decreased when it dropped sharply. Upon demodulation, the DM-demodulated signal closely
resembled the original input signal. However, it exhibited quantization errors, particularly when the
step size was relatively large. The Mean Squared Error (MSE) between the original and demodulated
signals was calculated to assess the accuracy of the demodulation process.
Adaptive Delta Modulation (ADM) Results:
Adaptive Delta Modulation (ADM) adapts its step size based on the input signal's characteristics. In
our experiments, a sampling frequency of [specify the sampling frequency] was used. The ADM-
modulated signal exhibited a pulse-like waveform with dynamically changing step sizes. The adaptive
nature of ADM allowed it to adjust its step size in response to variations in the input signal. It
effectively mitigated slope overload, resulting in a more accurate representation of the input signal
compared to DM. The step output of ADM demonstrated adaptive changes in step size as it tracked
the input signal's amplitude changes. Step size increased and decreased dynamically, preventing
slope overload. The ADM-demodulated signal closely followed the original input signal, maintaining
accuracy even during rapid changes. The MSE between the original and demodulated signals was
calculated to quantify the accuracy of the demodulation process.
Conclusion:
In conclusion, both Delta Modulation (DM) and Adaptive Delta Modulation (ADM) are modulation
techniques employed for analog-to-digital conversion. DM offers simplicity but may introduce
quantization errors and granular noise in rapidly changing input signals. On the other hand, ADM
provides an adaptive approach that adjusts its step size to combat slope overload, resulting in
enhanced accuracy. The choice between DM and ADM depends on the specific application and the
trade-offs between simplicity and accuracy.