Sei sulla pagina 1di 10

Gaurav Sharma

16BEE0153
C2+TC2
EXPERIMENT-7
FREQUENCY AND PHASE
MODULATION- DEMODULATION

Aim: To perform phase modulation and demodulation on a given input signal.

Apparatus: MATLAB

MATLAB Code:
Frequency Modulation – Demodulation
clc;
clear all;
close all;
N=100;
tmax=2;
dt=tmax/(N-1);
t=0:dt:tmax;
fs=1/dt;
ac=2;
am=1;
fc=3;
wc=2*pi*fc;
xc=cos(wc*t);
fm=1;
wm=2*pi*fm;
xm=am*cos(wm*t);
kf=10;
xmi=cumsum(xm)*dt;
xfm=ac*cos(wc*t+kf*xmi);
dxfm=diff(xfm)/dt;
subplot(4,1,1);plot(xm); xlabel(‘Time’); ylabel(‘Amplitude’);
title(‘Message Signal’);
subplot(4,1,2);plot(xc); xlabel(‘Time’); ylabel(‘Amplitude’);
title(‘Carrier Signal’);
subplot(4,1,3);plot(xfm); xlabel(‘Time’); ylabel(‘Amplitude’);
title(‘ Frequency Modulated Signal’);
subplot(4,1,4);plot(dxfm); xlabel(‘Time’); ylabel(‘Amplitude’);
title(‘Frequency Demodulated Signal’);
Phase Modulation – Demodulation

MATLAB code:

clc;
clear all;
N=2000;
tmax=20;
dt=tmax/(N-1);
t=0;dt;tmax;
fs=1/dt;
Ac=2;
Am=1;
fc=3;
wc=2*pi*fm;
xc=cos(wc*t);
fm=0.2;
wm=2*pi*fm;
xm=Am*sin(wm*t);
kp=10;
xpm=Ac*sin(wc*t+kp*xm);
theta=pi/3;
xc=cos(wc*t+theta);
xs=sin(wc*t+theta);
I=xpm.*xc;
Q=xpm.*xs;
d=-1*atan2(Q,I);
xd=unwrap(d);
subplot(4,1,1);
plot(xm);
xlabel(‘time’);ylabel(‘amplitude’);title(‘message signal’);
subplot(4,1,2);
plot(xc);
xlabel(‘time’);ylabel(‘amplitude’);title(‘carrier signal’);
subplot(4,1,3);
plot(xpm);
xlabel(‘time’);ylabel(‘amplitude’);title(‘phase modulated signal’);
subplot(4,1,4);
plot(xd);
xlabel(‘time’);ylabel(‘amplitude’);title(‘phase demodulated signal’);

Result: Frequency Modulation-Demodulation & phase modulation-demodulation was performed


successfully in MATLAB.

Inference: In FM, a radio wave known as the "carrier wave" is modulated in frequency by the
signal that is to be transmitted. The amplitude and phase remain the same.
In PM, a radio wave known as the "carrier wave" is modulated in phase by the signal that is to be
transmitted. The frequency and amplitude remain the same.
Gaurav Sharma
16BEE0153
C2+TC2
Experiment 8
AMPLITUDE, FREQUENCY AND PHASE
MODULATION – DEMODULATION WITH NOISE

Aim: To perform amplitude modulation-demodulation, frequency modulation-demodulation and


phase modulation – demodulation on a given signal with noise in MATLAB.

Apparatus: MATLAB
MATLAB Code:
AM with noise-
clc;
clear all;
close all;
t=linspace(0,0.02,10000); fc=5000; fm=200; fs=40000;
Am=5; Ac=10;
m= Am/Ac;
wc =2*pi*fc; wm=2*pi*fm;
em = Am*sin(wm*t); ec = Ac*sin(wc*t);
y = Ac*(1+m*sin(wm*t).*sin(wc*t));
z=awgn(y,20);
d = amdemod(y,fc,fs,30);
l=10000;
subplot (5,1,1); plot(t,em); xlabel('Time'); ylabel('Amplitude');
title('Message signal');
subplot(5,1,2); plot(t,ec); xlabel('Time'); ylabel('Amplitude'); title('Carrier signal');
subplot(5,1,3); plot(t,y); xlabel('Time'); ylabel('Amplitude');
title('Amplitude modulated signal');
subplot(5,1,4); plot(t,d); xlabel('Time'); ylabel('Amplitude');
title('Amplitude demodulated signal');
subplot(5,1,5); plot(t,z); xlabel('Time'); ylabel('Amplitude');
title('Amplitude modulated signal with noise');

FM with Noise-

clc;
clear all;
close all;
N=100;
tmax=2;
dt=tmax/(N-1);
t=0:dt:tmax;
fs=1/dt;
ac=2;
am=1;
fc=3;
wc=2*pi*fc;
xc=cos(wc*t);
fm=1;
wm=2*pi*fm;
xm=am*cos(wm*t);
kf=10;
xmi=cumsum(xm)*dt;
xfm=ac*cos(wc*t+kf*xmi);
y=awgn(xfm,20);
dxfm=diff(xfm)/dt;
subplot(5,1,1);plot(xm); xlabel('Time'); ylabel('Amplitude');
title('Message Signal');
subplot(5,1,2);plot(xc); xlabel('Time'); ylabel('Amplitude');
title('Carrier Signal');
subplot(5,1,3);plot(xfm); xlabel('Time'); ylabel('Amplitude');
title('Frequency Modulated Signal');
subplot(5,1,4);plot(dxfm); xlabel('Time'); ylabel('Amplitude');
title('Frequency Demodulated Signal');
subplot(5,1,5);plot(y); xlabel('Time'); ylabel('Amplitude'); title('Frequency modulated Signalwith
noise');

PM with Noise-

clc;
clear all;
N=2000;
tmax=20;
dt=tmax/(N-1);
t=0:dt:tmax;
fs=1/dt;
Ac=2;
Am=1;
fc=3;fm=1;
wc=2*pi*fm;
xc=cos(wc*t);
fm=0.2;
wm=2*pi*fm;
xm=Am*sin(wm*t);
kp=10;
xpm=Ac*sin(wc*t+kp*xm);
y=awgn(xpm,20);
theta=pi/3;
xc=cos(wc*t+theta);
xs=sin(wc*t+theta);
I=xpm.*xc;
Q=xpm.*xs;
d=-1*atan2(Q,I);
xd=unwrap(d);
subplot(5,1,1);
plot(xm)
xlabel('time');ylabel('amplitude');title('message signal');
subplot(5,1,2);
plot(xc)
xlabel('time');ylabel('amplitude');title('carrier signal');
subplot(5,1,3);
plot(xpm)
xlabel('time');ylabel('amplitude');title('phase modulated signal');
subplot(5,1,4);
plot(xd)
xlabel('time');ylabel('amplitude');title('phase demodulated signal');
subplot(5,1,5);
plot(y)
xlabel('time');ylabel('amplitude');
title('phase modulated signal with noise');
AM with Noise:

FM with Noise:
PM with Noise:

Result: Amplitude Modulation-Demodulation, Frequency Modulation-Demodulation and Phase


modulation – demodulation on a signal with noise was performed successfully in MATLAB.

Inference: Signal-to-noise ratio (abbreviated SNR or S/N) is a measure used in science and
engineering that compares the level of a desired signal to the level of background noise. SNR is
defined as the ratio of signal power to the noise power, often expressed in decibels. A ratio
higher than 1:1 (greater than 0 dB) indicates more signal than noise. Higher the SNR, better is
the signal quality.
Gaurav Sharma
16BEE0153
C2+TC2

Experiment 9
Single side band (SSB) modulation – demodulation

Aim: To perform SSB modulation-demodulation and DSB modulation-demodulation on a given signal in


MATLAB.

Software used:
MATLAB

MATLAB Code

Single side band (SSB):


clc; clear all;
N=1024; fs=2048;
ts=1/fs; t=(0:N-1)/fs;
fc=600; fm=100; Am=1;
Ac=1;
xm=Am*cos(2*pi*fm*t);
xmh=Am*cos((2*pi*fm*t)-pi/2);
xc=Ac*cos(2*pi*fc*t);
xch=Ac*cos((2*pi*fc*t)-pi/2);
sbu=(2*xm.*xc)-(2*xmh.*xch);
sbl=(2*xm.*xc)+(2*xmh.*xch);
SBU=2/N*abs(fft(sbu));
SBL=2/N*abs(fft(sbl)); freq=fs*(0:N/2)/N;
subplot(9,1,1); plot(t,xm); xlabel('Time'); ylabel('Amplitude'); title('Message Signal'); subplot(9,1,2);
plot(t,xc); xlabel('Time'); ylabel('Amplitude'); title('Carrier Signal'); subplot(9,1,3); plot(t,xmh);
xlabel('Time'); ylabel('Amplitude'); title('Message Hilbert Transform Signal');
subplot(9,1,4); plot(t,xch); xlabel('Time'); ylabel('Amplitude'); title('Carrier Hilbert Transform Signal');
subplot(9,1,5); plot(t,sbu); xlabel('Time'); ylabel('Amplitude'); title('Side
Band Lower');
subplot(9,1,6); plot(t,sbl); xlabel('Time'); ylabel('Amplitude'); title('Side
Band Upper');
subplot(9,1,7); plot(freq,SBU(1:N/2+1)); xlabel('Frequency'); ylabel('Amplitude'); title('Side Band Lower
fft');

subplot(9,1,8); plot(freq,SBL(1:N/2+1)); xlabel('Frequency'); ylabel('Amplitude'); title('Side Band Upper


fft');
md=sbu.*cos((2*pi*fc*t)+180);
xp=unwrap(md);
subplot(9,1,9); plot(t,xp); xlabel('Time'); ylabel('Amplitude'); title('Demodulation');
Graph

Result
Single side band (SSB) modulation – demodulation has been performed successfully.

Inference
In radio communications, single-sideband modulation (SSB) or single-sideband suppressed-carrier
modulation (SSB-SC) is a type of modulation, used to transmit information, such as an audio signal,
by radio waves.

Potrebbero piacerti anche