You are on page 1of 5

Data Communication (E)

Lab Report 2

Chowdhury Md. Shahed hasan


ID: 17-35287-2
ID = AB-CDEFG-H
= 17-35287-2

signal x = x1 + x2 + x3

a1 = A + C + 1 = 1+3+1 =5
a2 = A + D + 2 = 1+5+2= 8
a3 = A + E + 1 = 1+2+1=4
f1 = A + E + 1 = 1+2+1 =4
f2 = A + D + 2 = 1+5+2 = 8
f3 = A + C + 1 = 1+3+1 = 5

x1 = a1*cos(2*pi*f1*t)
=5*cos(2*pi*4*t)
x2 = a2*sin(2*pi*f2*t),
= 8*sin(2*pi*8*t),
x3 = a3*cos(2*pi*f3*t),
=4*cos(2*pi*5*t).
a.
close all;
clc;
fs = 8000;
f = 4;
t = 0:1/fs:2;
x1=5*cos(2*pi*4*t);
x2=8*sin(2*pi*8*t);
x3=4*cos(2*pi*5*t);
signal = x1+x2+x3;
nx = length(t);
subplot(3,1,1);
plot(t, signal,'linewidth',1);
title('Time-Domain Representation of Signal');
xlabel('Time (s)');
ylabel('Amplitude');
fftSignal = fft(signal);
fftSignal = fftshift(fftSignal)/(nx/2);
f = linspace(-fs/2,fs/2,nx);
subplot(3,1,2);
plot(f, abs(fftSignal),'linewidth',2);
title('Frequency-Domain Representation of Signal');
xlabel('Frequency (Hz)');
ylabel('Amplitude');
xlim([-20 20]);
ylim([-20 20]);
b.
close all;
clc;
fs = 3000;
t = [0:1/fs:0.8];
f = 8;
sig = 2*sin(2*pi*f*t);
x1=5*cos(2*pi*4*t);
x2=8*sin(2*pi*8*t);
x3=4*cos(2*pi*5*t);
signal = x1+x2+x3;
partition = -1.5:1.5;
codebook = -2:2;
[index,quants] = quantiz(sig,partition,codebook);
%Figure;
plot(t,signal,'x',t,quants,'.')
legend('Original signal','Quantized signal');

You might also like