Sei sulla pagina 1di 19

Digital Modulation and Coding

Assignment -1

Prepared and Submitted by


EE19M016 – V S Rama Krishna Anne
EE19M017 – Lenin Kumar Chanumolu

We certify that this assignment submission is our own work and not obtained from
any other source.
Table of Contents
Problem 1 4
Parameters 4
Matlab Code 4
Band Pass Signal generation 5
Down Conversion 6
Low Pass Filtering 6
Observations 7

Problem 2 8
Parameters: 8
Matlab Code 8
SRRC pulse Roll Off: 0.35 11
SRRC Pulse in Time domain 11
SRRC Pulse in Frequency domain 11

SRRC pulse Roll Off: 0.7 12


SRRC Pulse in Time domain 12
SRRC Pulse in Frequency domain 12

SRRC pulse Roll Off: 1 13


SRRC Pulse in Time domain 13
SRRC Pulse in Frequency domain 13

Observations 13

Problem 3 14
Matlab Code 14
RC Pulse 15
Generated Bits 16
Pulse shaped data 17
Detected Output 17
Eye Diagram 18
Observations 19
Problem 1

Parameters
Sampling Frequency = 1 MHz
Carrier Frequency = 10Hz
Bandwidth of Sinc (Message Signal) = 1Hz

Matlab Code

%% 1(a)-Generating Passband Signal


close all;
clc;
clear all;
samplingFrequency = 1e2;
durationBetweenSamples=1/samplingFrequency ;
N= ceil(5/durationBetweenSamples);
numberOfSamplesAxis = [-N:N];
timeAxis = numberOfSamplesAxis*durationBetweenSamples;
timeAxis_usec = timeAxis.*1e6;
carrierFrequency = 10; % carrier freq in ques
% carrierFrequency = samplingFrequency/4% carrier freq is filtered
out
% carrierFrequency = samplingFrequency/10 % carrier freq not
filtered out

passbandSignal_up_t = sinc(timeAxis).*cos(2*carrierFrequency*pi*timeAxis);

figure;
plot(timeAxis_usec,passbandSignal_up_t);
xlabel('Time in micro sec');
ylabel('Amplitude');
title('Modulated Signal Up_t')
% Down Converter
downConvertedOutput = 2* passbandSignal_up_t
.*cos(2*carrierFrequency*pi*timeAxis);
figure
plot(timeAxis_usec,downConvertedOutput);
xlabel('Time in micro sec');
ylabel('Amplitude');
title('Downconverted Modulated Signal Up_t');

% Moving Average Filter


lpf_coeffs = ones(1,5); %1 us window
filterOutput = filter(lpf_coeffs,1,downConvertedOutput);

figure;
plot(timeAxis_usec,filterOutput);
xlabel('Time in micro sec');
ylabel('Amplitude');
title('Moving Average output');

%% Observation
figure;
freqz(lpf_coeffs);
title('Frequency Response of Moving Average Filter');

Band Pass Signal generation


Down Conversion

Low Pass Filtering


Parameters:
Sampling Frequency: 1MHz
Moving average filter window Length: 2
Observations
It was suggested to select the sampling frequency as 10 times of carrier frequency, even then selected
sampling frequency as 1 MHz to implement the moving average filter over 1 µsec.
Carrier frequency is so low and implemented filter cutoff frequency is high, hence the carrier frequency is
passed through Low Pass filter.
Base band signal obtained is plotted in below figure:
Parameters:
Sampling Frequency: 100Hz Sampling Duration: 10m.sec
Moving Average filter Window length: 5 (integrated over 50m.sec)
Problem 2

Parameters:
Symbol Rate: 25K

Symbol Duration: 1/ Symbol Rate 25K = 40µSec

Sampling Frequency = 8* Symbol Rate = 200KHz

Duration of pulse = Sampling Frequency * Symbol Duration = 8

Matlab Code
clc;
clear all;
close all;
alpha = [.35 0.7 1]; % roll off factor
SymbolRate = 25000;
timePeriodOfSymbol = 1/SymbolRate;
SamplingFrequency = 8*SymbolRate;
NofSamples = ceil(5*timePeriodOfSymbol*SamplingFrequency); %To
find No of samples in 5T duration
timeAxis = [-NofSamples:NofSamples]/SamplingFrequency; %time = -
5T:Ts:5T,i.e 10T duration
symbol_duration = length(timeAxis);
SRRC = zeros(numel(timeAxis),numel(alpha));

%generate srrc pulse with Symbol period T and rol of factor = 'alpha'

for iAlphaCnt = 1 : numel(alpha)


t=1;
a = alpha(iAlphaCnt);

for i=timeAxis
if (i == 0)
SRRC(t,iAlphaCnt) = 1-a+ 4*a/ pi;
elseif ((i== (timePeriodOfSymbol/4/a) || i== -
(timePeriodOfSymbol/4/a)))
SRRC(t,iAlphaCnt)=a/sqrt(2)*( (1+2/pi)*sin(pi/4/a) + (1-2/pi)*cos
(pi/4/a) );
else
SRRC(t,iAlphaCnt)= ( (sin( pi*(1-a)*i/timePeriodOfSymbol) +
4*a*i/timePeriodOfSymbol * cos (pi * (1+a)* i/ timePeriodOfSymbol)) /
(pi*i/timePeriodOfSymbol * (1- (4*a*i/timePeriodOfSymbol)^2 )) );
end
t=t+1;
end
end

% plot SRRC pulses


figure;
plot(timeAxis,SRRC(:,1),'Linewidth',2);
xlabel('Time')
ylabel('Amplitude')
grid on;
title('SRRC pulse for different roll-off 0.35')
figure;
plot(timeAxis,SRRC(:,2),'Linewidth',2)
grid on;
xlabel('Time')
ylabel('Amplitude')
title('SRRC pulse for different roll-off 0.7')
figure;
plot(timeAxis,SRRC(:,3),'Linewidth',2);
grid on;
xlabel('Time')
ylabel('Amplitude')
title('SRRC pulse for different roll-off 1')

% title('SRRC pulse for different roll-off values')


% legend('alpha=0.35','alpha=0.7','alpha=1')

% Find Frequency Response


NFFT = 1024;
pos_freq = 1:NFFT/2;
neg_freq = NFFT/2+1:NFFT;

y = zeros(NFFT,numel(alpha));
spectrum = zeros(NFFT,numel(alpha));

for iAlphaCnt = 1 : numel(alpha)


y(:,iAlphaCnt) = fft(SRRC(:,iAlphaCnt),NFFT);
spectrum(:,iAlphaCnt) = 20*log(abs(fftshift(y(:,iAlphaCnt)))); %Note
fftshift(y). This does y([neg_freq pos_freq])
end

figure;
freq_scale = [-NFFT/2:(NFFT/2-1)]*SamplingFrequency/NFFT;
plot(freq_scale,spectrum(:,1),'g', 'Linewidth',1);
xlabel('Freq in Hz')
ylabel('dB')
% title('Magnitude Response for SRRC pulse of roll-off value 0.35')
grid on;
% figure;
hold on;
plot(freq_scale,spectrum(:,2), 'm','Linewidth',1);
xlabel('Freq in Hz')
ylabel('dB')
% title('Magnitude Response for SRRC pulse of roll-off value 0.7')
grid on;
% figure;
plot(freq_scale,spectrum(:,3), 'b','Linewidth',1);hold off;
xlabel('Freq in Hz')
ylabel('dB')
% title('Magnitude Response for SRRC pulse of roll-off value 1')

legend('alpha=0.35','alpha=0.7','alpha=1');

grid on;
SRRC pulse Roll Off: 0.35
SRRC Pulse in Time domain

SRRC Pulse in Frequency domain


SRRC pulse Roll Off: 0.7
SRRC Pulse in Time domain

SRRC Pulse in Frequency domain


SRRC pulse Roll Off: 1
SRRC Pulse in Time domain

SRRC Pulse in Frequency domain

Observations
As alpha (Roll-Off factor) value increases the Bandwidth occupancy increases.
Problem 3

Matlab Code

● Question code output is used as input

h_srrc=SRRC(:,3);
h_srrc= h_srrc';
rcPulseImpulse = conv(h_srrc,h_srrc);

rcPulseImpulse = rcPulseImpulse/max(rcPulseImpulse); % To Normalize the RC


pulse peak to 1
figure;
plot(rcPulseImpulse,'Linewidth',2);
grid on;
xlabel('Samples')
ylabel('Amplitude')
title('RC pulse for roll-off 0.7')
grid on

symbol_duration = ceil(T*fs); %symbol duration is T = T/Ts samples


[val center_idx] = max(rcPulseImpulse); %find the index of peak

bits = 2* [rand(1,20)>0.5] - 1; %generate random bits


b = upsample(bits, symbol_duration);%generate impulses spaced T sec apart
plot(b,'Linewidth',2);
grid on;
xlabel('Samples')
ylabel('Amplitude')
title('Generated Bits')
grid on

pul_shape_seq = conv(b,rcPulseImpulse); % pulse shapping = b(n).h_rc(t-nT)

figure;
plot(pul_shape_seq,'Linewidth',2);
grid on; title('Bit Seq After Pulse Shaping')
xlabel('Samples')
ylabel('Amplitude')
% title('RC pulse for roll-off 0.7')

peak_values = pul_shape_seq(center_idx:symbol_duration:end)
decoded_bits = peak_values(1:20)

figure;
stem(bits,'Linewidth',2); title('Bit Seq')
hold on;
stem(decoded_bits,'r'); legend('Txd Bits','Rxd bits')

% eyediagram(decoded_bits,8);
eyediagram(pul_shape_seq(center_idx:(center_idx+19*symbol_duration)),symbol_d
uration);
title('Eye Diagram with Roll Off 1 of RC Pulse')
grid on;

RC Pulse
Generated Bits
Pulse shaped data

Detected Output
Peak values of Decoded bits:

-1.00309032545198 1.00289701177797 -0.997719827613731 1.00265996451579


0.995973036482047 1.00656359845458 -1.00730867287451 -0.993694203360331
-1.00069749989025 0.999827952372837 -0.999876902105276 1.00029941779084
-1.00003700296060 -1.00027738645706 -1.00029803479035 -0.996788277958431
0.996168887686095 1.00265008693425 1.00210161567081 -0.997907992850259
Eye Diagram
Observations

There is no ISI observed with the Ideal sampling time for the RC pulse with Roll off of 1. As the Roll off is
reduced to 0.7 the jitter is more eye diagram is showing the same.

Potrebbero piacerti anche