ID=22-46790-1(DatacommLabR-02)
ID=22-46790-1(DatacommLabR-02)
FACULTY OF ENGINEERING
DATA COMMUNICATION
Fall 23-24
Section: I
Name ID
(a) Select the value of the amplitudes as follows: let 𝐴1 = G+D and 𝐴2 = A+F.
Solve:
The values of amplitude,
𝐴1 = G + D 𝐴2 = A + F
=0+6 =2+9
=6 = 11
(b) Make a plot of x3 over a range of t which will exhibit approximately 2 cycles. Make sure the plot
starts at a negative time so that it will include t = 0 and at least 20 samples per period of the wave.
Solve:
We have already obtained the values of A1 =6, A2 = 11, f1 =40 & f2. =90.
MATLAB Code:
fs = 1000;
t = -0.5:1/fs:0.5-1/fs;
f1 = 40;
f2 = 90;
A1 = 6;
A2 = 11;
x1 = A1*sin(2*pi*f1*t);
x2 = A2*sin(2*pi*f2*t);
x3 = x1+x2;
plot(t, x3)
Figure 1: Signal (𝑥3 ) Over Time (t).
(c) Plot x3 in the frequency domain and calculate its bandwidth.
Solve:
MATLAB Code:
A1 = 6;
A2 = 11;
f1 = 40;
f2 = 90;
fs =10000;
t= 0:1/fs:1-1/fs;
x1 = A1 * cos(2 * pi * f1 * t);
x2 = A2 * cos(2 * pi * f2 * t);
x3 = x1 + x2;
fx3 = fft(x3); fx3 = fftshift(fx3) / (fs / 2);
f = fs / 2 * linspace(-1, 1, fs);
subplot(4,1,4);
plot(f, abs(fx3));
axis([-1 95 0 15]);
xlabel('Frequency (Hz)');
ylabel('Amplitude');
title('Frequency Domain of x3');
Figure 2: Signal (𝑥3 ) in frequency domain.
We know that,
=90.50-40.50
=50Hz
(d) Quantize x3 in 6 equally distributed levels and provide image for one cycle of the original signal
and quantized signal.
Solve:
MATLAB Code:
fs = 1000;
t = 0:1/fs:1/f1;
f1 = 40;
f2 = 90;
A1 = 6;
A2 = 11;
% Original signal
x1 = A1 * cos(2 * pi * f1 * t);
x2 = A2 * cos(2 * pi * f2 * t);
x3 = x1 + x2;
% Quantization
L = 6;
min_x3 = min(x3);
max_x3 = max(x3);
q_levels = linspace(min_x3, max_x3, L);
q_step = (max_x3 - min_x3) / (L - 1);
% Plotting
figure;
subplot(2,1,1);
plot(t, x3, 'LineWidth', 1.5);
title('Original Signal x_3(t)');
xlabel('Time (s)');
ylabel('Amplitude');
subplot(2,1,2);
plot(t, x3_quantized, 'LineWidth', 1.5, 'Color', 'r');
title('Quantized Signal x_3(t) with 6 Levels');
xlabel('Time (s)');
ylabel('Amplitude');