You are on page 1of 13

Introduction to Communication

Systems Practicals
Name: Tejas Bobade Batch: (A3)

PRN: 20210802198

Practical 1

# 1 To plot sin waves and cos waves.


clc; clear all;
close all; A = 5; f
= 3; t = 0:0.01:1; x
= A*sin(2*pi*f*t);
subplot(2,1,1)
plot(t,x)
xlabel("Time")
ylabel("Amplitude")
title("Sin Wav")
A = 5; f = 3; t =
0:0.01:1; x =
A*cos(2*pi*f*t);
subplot(2,1,2)
plot(t,x)
xlabel("Time")
ylabel("Amplitude")
title("Cos Wav")
Practical 2

# 2 To plot the unit functions.

% unit impulse t
= 0:1:4;
y=[zeros(1,2), ones(1,1), zeros(1,2)];
subplot(2,2,1) stem(t,y)
ylabel("d(n)") xlabel("Unit Impulse")

% unit step n = 7;
t = 0:1:6; y1 =
ones(1,n);
subplot(2,2,2)
stem(t,y1);
ylabel("Amplitude")
xlabel("Unit Step")
% unit ramp signal
n = 15; t = 0:1:n -
1; subplot(2,2,3)
stem(t,t)
ylabel("Amplitude")
xlabel("Unit Ramp")

% Exponential Signal n = 15; t


= 0:1:n-1; a = 12; y2 =
exp(a*t); subplot(2,2,4)
stem(t, y2)
xlabel("Exponential Function")
ylabel("Amplitude")

#3 Implement low pass filter ,bandpass filter , high pass filter , bandstop filter

clc; close all;


% Low Pass filter
fs = 1e3; t =
0:1/fs:1;
x = 2*sin(2*pi*250*t) + randn(size(t))/10;
figure(1) lowpass(x,150,fs)

% high pass filter


fs = 1e3; t =
0:1/fs:1;

x = 2*sin(2*pi*250*t) + randn(size(t))/10;
figure(2) highpass(x,150,fs)

% band pass filter


fs = 1e3; t =
0:1/fs:1;
x = 2*sin(2*pi*250*t) + randn(size(t))/10; figure(3)
bandpass(x,[100,200],fs)

% bandstop filter
fs = 1e3; t =
0:1/fs:1;
x = 2*sin(2*pi*250*t) + randn(size(t))/10; figure(4)
bandstop(x,[100,200],fs)
Practical 4

#4 Represent a square wave as a Fourier series.


clc; clear all; close all; syms n t
w0 = pi; t0 = 2; n = 1:5; a0 =
(1/t0)*int(1,t,0,1) an =
(2/t0)*int(1*cos(n*w0*t),t,0,1) bn =
(2/t0)*int(1*sin(n*w0*t),t,0,1)

clc; close all; t =


0:0.1:10; y = sin(t);
subplot(2,2,1) plot(t,y)
y = sin(t) + sin(3*t)/3;
subplot(2,2,2) plot(t,y)
y = sin(t) + sin(3*t)/3 + sin(5*t)/5 + sin(7*t)/7 + sin(9*t)/9;
subplot(2,2,3) plot(t,y)

t = 0:.02:6.28; y =
zeros(10,length(t)); x =
zeros(size(t)); for k =
1:2:19 x = x +
sin(k*t)/k;
y((k+1)/2,:) = x;
end subplot(2,2,4)
plot(t,y)
Practical 5
#5 Amplitude Modulation using MATLAB
am = 3; fm = 2; ac = 5;
fc = 60; t = 0:0.001:1;
em = am*sin(2*pi*fm*t);
subplot(3,1,1) plot(t,
em);
ec = ac*sin(2*pi*fc*t);
subplot(3,1,2) plot(t,ec) m =
am/ac; eam =
ac*(1+m*sin(2*pi*fm*t)).*ec;
subplot(3,1,3); plot(t,eam); y =
fft(eam); figure(2) plot(abs(y))

___________________________________________________________

Practical 6

#6 Double Side Band Carrier Suppressed Carrier Wave using MATLAB


clc; close all;
Am = 20;
Ac = 200;
Fm = 4; Fc = 40; t =
0:0.001:1; em =
Am*(sin(2*pi*Fm*t));
subplot(4,1,1) plot(t,em)
ec = Ac*(sin(2*pi*Fc*t));
subplot(4,1,2) plot(t,ec)
eDSBC = em.*ec;
subplot(4,1,3) plot(t,
eDSBC)
subplot(4,1,4)
plot(abs(fft(eDSBC)))
Practical 7

#7 Generation of Single Sideband Suppressed Carrier using MATLAB


clc; close all;
Am = 20;
Ac = 200;
Fm = 4;
Fc = 40; fs
= 1000; t =
0:1/fs:1;

eDSBSC = ((Am*Ac)/2)*(cos(2*pi*(Fc - Fm)*t)+cos(2*pi*(Fc + Fm)*t));


new =
fft(eDSBSC);
subplot(2,1,1)
plot(t,new);

eSSBSC = ((Am*Ac)/2)*(cos(2*pi*(Fc - Fm)*t)); new2


= fft(eSSBSC);
subplot(2,1,2)
plot(t,new2)
Practical 8

#8 Frequency Modulation using Modulation Signals.


t = 0:0.001:1;
Ac = 100;
Am = 10;
fm = 4;
fc = 30;
kf = 1;
beta = (kf*Am)/fm;

mt = Am*cos(2*pi*fm*t);
st = Ac*cos(2*pi*fc*t + beta*sin(2*pi*fm*t));
subplot(2,1,1)
plot(t,mt)
title("Message Signal")
subplot(2,1,2)
plot(t, st)
title("Frequency Modulated Signal")
Practical 9

#9 Generation of Phase Modulation Wave.


clc; close all;
fs = 1000;
t = 0:1/fs:1;
Am = 3;
Ac = 5; fm = 2; fc =
60; kp = 14; mt =
Am*cos(2*pi*fm*t);
subplot(4,1,1)
plot(t,mt)
title("Message Signal")
ct = Ac*cos(2*pi*fc*t);
subplot(4,1,2)
plot(t,mt)
title("Carrier Wave")

pt = Ac*(cos(2*pi*fc*t + kp.*(mt)));
subplot(4,1,3) plot(t,pt)
title("Phase Modulated Wave")
Practical 10

#10 Sample theory with MATLAB


clc; close all;
am = 1; fm =
5;
f=100; %frequency of the impulse in Hz
% fs > 2fm
fs=f*200; % sample frequency is 10 times higher
t=0:1/fs:1; % time vector y=zeros(size(t));
% in a particular frequency it is setting the value
% of zero to one for a short period creating an impulse
% train y(1:fs/f:end)=1;
subplot(3,1,1); plot(t,y)
title("Impulse Train") mt
= am*(sin(2*pi*fm*t));
subplot(3,1,2);
plot(t,mt);
title("Message Signal")
st = y.*mt;
subplot(3,1,3);
plot(t,st) title("Sampled
Signal")
Practical 11

Aim: Noise Theory with MATLAB.

clc; clear all; close all;


A = 3; f = 2; t =
0:0.001:1;
signal =
A*sin(2*pi*f*t);
subplot(2,1,1)
plot(t,signal)
title("Original Signal")

dsignal = awgn(signal, 10);


subplot(2,1,2) plot(t,
dsignal) title("Signal with
noise")

You might also like