Professional Documents
Culture Documents
EE15B131&74 Assign2
EE15B131&74 Assign2
- Use RC with with twice the bandwidth and roll-off 0.3 as Rx filter
- Convolve the Tx and Rx and comment about Nyquist property
The convolution output is nyquist at twice the symbol rate, because the bandwidth
of receive filter is double that of transmit filter. Convolution filter satisfies nyquist
property
Code:
clear all;
close all;
a=.3; %roll off factor
T=1/25000; %reciprocal of symbol rate
os=8;
tr=10;
t= -tr*T:T/os:tr*T;
for i= 1:length(t)
if(t(i)==0)
Y(i)=1;
else if(t(i)==T/2/a | t(i)==-T/2/a )
Y(i)=pi/(4*T)*sin(pi/(2*a))/(pi/2/a);
else
Y(i)=(sin(pi*t(i)/T))/(pi*t(i)/T)*cos(pi*a*t(i)/T)/(1-(2*a*t(i)/T)^2);
end
end
end
figure(1);
stem(t,Y);
title('Tx Filter')
xlabel('time')
ylabel('Amplitude')
N=1024;
y=fftshift(fft(Y,N));
f = (-N/2:N/2-1)/N; % Frequency vector
figure(2);
freqres=20*log10(abs(y))-20*log10(abs(y(513)));
plot(f,freqres);
title('Tx Filter Frequency Response')
xlabel('frequency')
ylabel('Amplitude')
a=.3; %roll off factor
T1=1/(2*25000); %reciprocal of symbol rate
os=4;
tr=10;
t1= -tr*T1:T1/os:tr*T1;
for i= 1:length(t1)
if(t1(i)==0)
Y1(i)=1;
else if(t1(i)==T1/2/a | t1(i)==-T1/2/a )
Y1(i)=pi/(4*T1)*sin(pi/(2*a))/(pi/2/a);
else
Y1(i)=(sin(pi*t1(i)/T1))/(pi*t1(i)/T1)*cos(pi*a*t1(i)/T1)/(1-(2*a*t1(i)/T1)^2);
end
end
end
figure(3);
stem(t1,Y1);
title('Rx Filter')
xlabel('time')
ylabel('Amplitude')
N=1024;
y1=fftshift(fft(Y1,N));
f = (-N/2:N/2-1)/N; % Frequency vector
figure(4);
freqres=20*log10(abs(y1))-20*log10(abs(y1(513)));
plot(f,freqres);
title('Rx Filter Frequency Response')
xlabel('Frequency')
ylabel('Amplitude')
Z=conv(Y,Y1);
t2=-tr*(T1+T):T1/os:tr*(T1+T);
figure(5)
stem(t2,Z)
title('Convolution Output')
xlabel('Time')
ylabel('Amplitude')
N=1024;
z=fftshift(fft(Z,N));
f = (-N/2:N/2-1)/N; % Frequency vector
figure(6);
freqres=20*log10(abs(z))-20*log10(abs(z(513)));
plot(f,freqres);
title('Convolution Output Frequency Response')
xlabel('Frequency')
ylabel('Amplitude')
2 . 16 -QAM modulation.
Maximum eye opening is at 0 and it has 4 distinct levels at 0.
Code:
%Generating 16 QAM
M = 16; % Size of signal constellation
k = log2(M); % Number of bits per symbol
n = 2000; % Number of bits to process
numSamplesPerSymbol = 8; % Oversampling factor
dataIn = randi([0 1],n,1); % Generate vector of binary data
dataInMatrix = reshape(dataIn,length(dataIn)/k,k); % Reshape data into binary
k-tuples, k = log2(M)
dataSymbolsIn = bi2de(dataInMatrix); % Convert to integers
dataMod = qammod(dataSymbolsIn,M); % Gray coding, phase offset = 0
scatterplot(dataMod,1,0,'k*');
%Designing RC Filter
Nsym = 10; % Filter span in symbol durations
beta = 0.3; % Roll-off factor
sampsPerSym = 8; % Upsampling factor
rctFilt = rcosdesign(0.3,10,8,'normal');
%Applying FIlter
txSignal = upfirdn(dataMod, rctFilt, numSamplesPerSymbol, 1);
%Plotting Eye Diagram
eyediagram(txSignal,numSamplesPerSymbol*2);
3.
The pulse does not satisfy Nyquist Criterion, since from the graph we cannot find
samples that are zero at T intervals. This results in ISI.
Conclusions about effects of ISI:
1. Eye openings are narrow
2. Difficult to detect the signal since 2 distinct levels are not seen
Code:
clear all;
close all;
%Generating QPSK data
M = 4; % Size of signal constellation
k = log2(M); % Number of bits per symbol
n = 2000; % Number of bits to process
numSamplesPerSymbol = 8; % Oversampling factor
dataIn = randi([0 1],n,1); % Generate vector of binary data
dataInMatrix = reshape(dataIn,length(dataIn)/k,k); % Reshape data into binary
k-tuples, k = log2(M)
dataSymbolsIn = bi2de(dataInMatrix); % Convert to integers
dataMod = qammod(dataSymbolsIn,M); % Gray coding, phase offset = 0
scatterplot(dataMod,1,0,'k*');
hold off;
a=.2; %roll off factor
T=1/25000; %reciprocal of symbol rate
os=8;
tr=10;
t= -tr*T:T/os:tr*T;
T_new = T*5/3;
for i= 1:length(t)
if(t(i)==0)
Y(i)=1;
else if(t(i)==T_new/2/a | t(i)==-T_new/2/a )
Y(i)=pi/(4*T)*sin(pi/(2*a))/(pi/2/a);
else
Y(i)=(sin(pi*t(i)/T_new))/(pi*t(i)/T_new)*cos(pi*a*t(i)/T_new)/(1-(2*a*t(i)/T_new)
^2);
end
end
end
figure(4);
stem(t,Y);
title('Filter')
xlabel('time')
ylabel('Amplitude')
N=1024;
y=fftshift(fft(Y,N));
f = (-N/2:N/2-1)/N; % Frequency vector
figure(2);
freqres=20*log10(abs(y))-20*log10(abs(y(513)));
plot(f,freqres);
title('Filter Frequency Response')
xlabel('Frequency')
ylabel('Amplitude')
txSignal = upfirdn(dataMod, Y, numSamplesPerSymbol, 1);
eyediagram(txSignal,numSamplesPerSymbol*2);