0% found this document useful (0 votes)
52 views25 pages

Digital Communications Assignment: By: Francisco Cantero - 12040673

This document discusses digital communication techniques including frequency analysis of pulse trains, raised cosine filters, and digital modulation. It presents the theory, implementation, and results for each topic. For frequency analysis of pulse trains, it generates rectangular pulse trains and analyzes the time and frequency domains. For raised cosine filters, it calculates the frequency response and impulse response for different roll-off factors. For digital modulation, it implements amplitude-shift keying, frequency-shift keying, and phase-shift keying.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views25 pages

Digital Communications Assignment: By: Francisco Cantero - 12040673

This document discusses digital communication techniques including frequency analysis of pulse trains, raised cosine filters, and digital modulation. It presents the theory, implementation, and results for each topic. For frequency analysis of pulse trains, it generates rectangular pulse trains and analyzes the time and frequency domains. For raised cosine filters, it calculates the frequency response and impulse response for different roll-off factors. For digital modulation, it implements amplitude-shift keying, frequency-shift keying, and phase-shift keying.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

DIGITAL COMMUNICATIONS

Assignment
By:
Francisco Cantero 12040673


[Link] Computers and Communication Systems


Table of Contents
Frequency domain and spectrum of a periodic data pulse train .......................................................................... 3
Aim and theory .................................................................................................................................................. 3
Implementation ................................................................................................................................................. 4
Results ............................................................................................................................................................... 4
Raised Cosine Filter ............................................................................................................................................... 6
Aim and theory .................................................................................................................................................. 6
Implementation ................................................................................................................................................. 7
Results ............................................................................................................................................................... 8
M-PAM analysis with eye diagrams .................................................................................................................... 10
Aim and theory ................................................................................................................................................ 10
Implementation ............................................................................................................................................... 11
MPAM sequence ......................................................................................................................................... 11
Design Raised Cosine Filter ......................................................................................................................... 12
Adding White Gaussian Noise ..................................................................................................................... 14
Eye Diagram ................................................................................................................................................. 15
Results ............................................................................................................................................................. 18
Digital Modulation ............................................................................................................................................... 20
Aim and theory ................................................................................................................................................ 20
Implementation ............................................................................................................................................... 20
ASK ............................................................................................................................................................... 20
FSK ............................................................................................................................................................... 22
PSK ............................................................................................................................................................... 23
Results ............................................................................................................................................................. 25



Frequency domain and spectrum of a periodic data
pulse train
Aim and theory
To analyze the time and frequency domain waveforms of a pulse train.


X(t)= A -/2<t< /2
0 /2<t< -/2

The general expression for the trigonometrical furrier series expansion of a function x(t) is:

Where:




If we perform the fast Fourier transform of this signal then we get that:



Implementation

The first step is to generate the rectangular pulse train, there are various methods to do this:

-simply entering a vector depending on the duty cycle () for the required number of samples that composes
the 10 periods of the signal (or any other period)

for i=1:num_of_samples
if mod(i,100)<Duty
signal(i)=1;
else
signal(i)=0;
end;
end;

-Another method is to use the inbuilt Matlab function, where the pulseperiod vector should be calculated and
it paces at those time a rectangular pulse of width equal to the duty cycle.
pulstran(t,pulseperiods,@rectpuls,pulsewidth);

The spectral analysis of this pulse train can be done using a FFT of the signal or as stated in the theory it can
be evaluated by the sinc() function, which is equivalent.
The user will have to enter the period and the data pulse width.


Results
The rectangular pulse train was generated with the pulsetrain function, and the script generated takes the
period T and pulse width tau from the user and plots the time domain and the frequency domain. Figure 1
shows the time domain and Figure 2 and Figure 3 shows the spectrum of the signal.

Figure 1 time domain rectangular pulse train


Figure 2 spectrum of rectangular pulse train for tau=10us


Figure 3 spectrum of rectangular pulse train for tau=20us
With the increase of tau we can see that the BW of the signal gets reduced, and this makes sense
since the first zero is located at a frequency of (1/tau), so if our tau is 10us then the first zero is at 100kHz as
in Figure 2, and if our tau gets increased to 20us the first zero crossing will happen at half the frequency as
seen in Figure 3.

Raised Cosine Filter
Aim and theory
Calculate and plot the frequency response and the pulse time response for a raised cosine filter and calculate
the actual modulation bandwidth for different roll-off factors.

Input to the Matlab function has to be alpha and the roll-off factor and the symbol period.

The raised cosine filter is a commonly used as a Nyquist filter, the BW occupied by a signal is increased by the
factor (1+ alpha) where alpha is the roll-off factor of the filter which define the width of the middle
frequencies that will attenuated by the raised cosine filter. If the roll-off factor is 0 then it is a brick wall as can
be seen in Figure 4.

Figure 4 raised cosine filter roll-off factor
The information symbol with a symbol period T can be transmitted without inter symbol interference (ISI) by
using Nyquist pulse to achieve this can be done with a sinc filter that achieves bandlimited transmission
within 1/2 Hz without inter-symbol interference, but the sinc filter has the following issues:

1. The tail of the sinc filter decays slowly. Note that practical implementations cannot use a filter which
extends from - to + . To ensure that only filter taps having small values are only ignored, need to use a
filter of large length.

2. Small errors in timing synchronization at the receiver will result in significant intersymbol interference.
Reason: The error in timing synchronization means that the sampling time at the receiver is not aligned. This
implies that filter tap values at time -2T, -T, T, 2T ... are non-zero. Hence results in significant inter symbol
interference.

For this reason the raised cosine filter is a commonly used pulse shaping that meets the Nyquist criterion as it
has a faster decay of the tail and its equation is:




Implementation
The implementation of the raised cosine filter can be done various ways, the way it is implemented for this
lab was using the built in rcosine() function that takes as parameters the sampling frequency of the filter, the
sampling frequency of the data or signal, the kind of filter to be implemented and the roll-off factor.
To estimate the frequency response, there are three cases for the output:

Where is the roll-off factor and T is 1/Fs.
To estimate the impulse response of the filter we can use the inbuilt impz() which will plot the impulse
response of the filter.
Various were tested in order to gain knowledge about the effects of the roll-off factor of the raised cosine
filter as can be seen in this part of the code.
f or n=0: 3
al pha( n+1) =n/ 3;
r ai sed_cosi ne = r cosi ne( Fd, Fs, ' f i r ' , al pha( n) ) ;
[ H1( n+1, : ) T1( n+1, : ) ] =i mpz( r ai sed_cosi ne) ;
T1( n+1, : ) =T1( n+1, : ) - 96;
end;
%Or coul d be done as:
f or n=1: 4
f or i =1: 400
%var =t i me/ bi t dur at i on
var =( i - 200+0. 1) / 50;
Xaxi s2( i ) =var ;
H( i ) =( si n( pi *var ) / ( pi *var ) ) *cos( pi *al pha( n) *var ) / ( 1-
4*al pha( n) *al pha( n) *var *var ) ;
end
end
For the frequency response:
f or j =0: 3
f or n=1: 200
%var =f r equency*bi t dur at i on
var =( n) / 160;
Xaxi s1( n) =var ;
i f ( var <( 1- al pha( j +1) ) / 2) %passband
H2( j +1, n) =1;
end;
i f ( var >( 1- al pha( j +1) ) / 2) %r ol l - of f
H2( j +1, n) =0. 5*( 1+cos( ( pi / al pha( j +1) ) *( var - ( 1- al pha( j +1) ) / 2) ) ) ;
end;
i f ( var >( 1+al pha( j +1) ) / 2) %r ej ect i on band
H2( j +1, n) =0;
end;
end;
end;





Results
The impulse response of the filter for various can be seen in Figure 5.

Figure 5 raised cosine filter impulse response
The Nyquist first criterion for zero ISI can be observed in Figure 6 when the signal is sampled at regular
intervals of multiples of pi/wc.

Figure 6 Nyquist zero ISI


The frequency response for different roll-off factors can be seen in Figure 6.

Figure 7 raised cosine filter frequency response
From the results we can say that as the value of the roll-off factor increases the ringing effect in the response
decreases, but this means that the whole passband of the filter gets attenuated and the BW of the signal
increases so the effective BW after applying the raised cosine filter gets factored by (1+ ).

We can see that the ideal brick-wall filter corresponds to a roll-off factor of 0 as seen in Figure 6.

From Figure 5 we can observe how the tail of the raised cosine filter changes with the roll-off factor and we
can see that when this increases the tail amplitude gets reduced.


To conclude we can say that the roll-off factor governs the occupied bandwidth and the rate at which the tails
of the pulse decay. A value of = 0 offers the narrowest bandwidth, but the slowest rate of decay in the time
domain. But when = 1 the BW is the widest (1+1)Fs and the higher decay rate.




M-PAM analysis with eye diagrams
Aim and theory
The aim of this exercise is to analyze M-PAM and its eye diagrams.
This is done in the following steps:
Generation an M-PAM vector
Filter the vector with a raised cosine filter
Add white Gaussian noise to the filtered data
Plot eye diagrams for the filtered data and noisy data.
The eye diagram will help to analyze the filtered data and the noisy data to see the effects of S/N ratio,
number of levels and the roll-off factor of the raised cosine has to the eye diagram of the M-PAM and to the
channel capacity.
C=B*( 1+al pha) *( l og2( SNR+1) )

The eye diagram analysis of the signal can be seen in Figure 8.

Figure 8 Eye diagram analysis


Implementation
There are various parts in this exercise:
MPAM sequence
Using the alphabet (-3,-1,1,3) we can generate 4PAM signal, this gets generated by the random function that
places the alphabet in vector of a determined length which is one of the inputs M.
k = M*Fs; %l enght of t he si gnal
ak = [ - 7, - 5, - 3, - 1, 1, 3, 5, 7] ; %al phabet f or a 8PAM used t o ver i f y t he
pt = r andsr c( 1, k, ak) ; %si gnal t o be pr ocess

The plot of this signal can be done with a stem and overlapped with a plot of the vector so we can see the
envelope of the stem. This can be seen in Figure 8 which is a vector of length 50 for plotting purposes.

Figure 9 input vector of 8PAM



Design Raised Cosine Filter
This is following the procedure introduced in the raised cosine filter exercise. We can specify the roll-off facto
that we want to see the effect in BW and in the eye opening. Figure 9 is the impulse response of the RC filter
with an alpha of 1.

Figure 10 Raised Cosine Filter alpha 1

Once the filter is generated we can filter the vector generated in step one and store the results in a new
vector for analyzing later on.
r r cf i l t er = r cosi ne( 1/ T, Fs, ' f i r ' , al pha) ;
f i gur e( 2) ;
i mpz( r r cf i l t er ) ;
f i l t er _dat a = r cosf l t ( pt , 1/ T, Fs, ' f i l t er ' , r r cf i l t er ) ;

Figure 10 is a plot of the filtered data, we can appreciate the truncation that is happening at the beginning
and end of the filtered vector, this has to be taken in to account for the next steps and we should remove this
truncation from the vector ntrunc*Fs/2 where ntrunc is based in the oversampling of the RC filter.


Figure 11 Filtered 8PAM signal
We need to filter the signal to avoid ISI as was seen in the raised cosine filter exercise.


The effects of the filtering to the signal can be seen in Figure 12 for an alpha of 1, we can see that the channel
is shaped with the raised cosine filter and Figure 13 with an alpha of 0 we can see that the channel is filtered
with a brick wall and the spectrum is nearly square.

Figure 12 RC filter alpha=1

Figure 13 RC filter alpha=0


Adding White Gaussian Noise
An AWGN channel is assumed, this will simulate the noise that will be added by the channel:
R(t)= x(t) + n(t)
The received signal is going to be the filtered signal with the addition of the AWGN noise.

The noise has to be calculated in terms of the SNR that is specified, for doing this we need to calculate the
power of the filtered data:

power _t i medomai n = sum( abs( f i l t er _dat a) . ^2) / l engt h( f i l t er _dat a)
noi se_shoul d_be=( power _t i medomai n/ SNR)

Then we have a value for the power of the AWGN, that is generated using the wgn() function:

noi se = wgn( l engt h( f i l t er _dat a) , 1, 100*noi se_shoul d_be, ' dBm' ) ;
AWGN = f i l t er _dat a+noi se;

In Figure 11 we can see the time domain plot of the AWGN that is the filtered data with the addition of noise,
this is for a 4PAM vector, we can see that the noise is affecting the signal and thus errors will be introduced in
the receiver. And in Figure 12 we can see the spectrum of the filtered data, the noise and the AWGN signal.

Figure 14 AWGN= filter data + noise


Figure 15 spectrum of noise and AWGN signals
Eye Diagram
The eye diagram shows a lot of useful information like the time that we are able to sample the signal with
fidelity, the horizontal presents the amount of signal variation at the time that is sampled. This variation is
related the SNR, a small band will yield to a larger SNR.
The eye diagram can be obtained by using the inbuilt function eyediagram(filter_data(ntrunc*Fs/2-
3:length(filter_data)-ntrunc*Fs/2),Fs) or we can create our own eye diagram as follows:
f i gur e;
eyet est =[ ] ;
hol d on
f i l t er _dat a=f i l t er _dat a( nt r unc*Fs/ 2- 3: l engt h( f i l t er _dat a) - nt r unc*Fs/ 2) ;
f or j =Fs: 3*Fs: ( l engt h( f i l t er _dat a) - 5)
eyet est =f i l t er _dat a( j - 3: j +3*Fs- 2) ;
pl ot ( eyet est ) ;
end;
hol d of f ;

This will take the wanted vector to be analyzed and divided in Fs length samples where Fs is the oversampling
ratio of the raised cosine filter, then it will plot all the different sections that we have calculated in the same
graph by overlapping them.

Figure 13 shows the eye diagram of 3 time slots of a 4PAM signal filtered with a RC with a roll-off factor of 1,
this means that the eye has a wider opening which gives a much greater tolerance to inaccurate sample clock
timing, this means that we get a hit in terms of bandwidth as the BW gets increased by the (1+roll-off factor).

Figure 14 shows the results for the same setup but using the built eye diagram function.


Figure 16 Filtered data Eye diagram of 3 time slots

Figure 17 Built in eye function







The same procedure is done to plot the eye diagram for the AWGN signal and this is shown in Figure 15
where the SNR ratio of the received signal is set to 70dB that added to the roll of factor makes a good signal
to recover and Figure 16 shows the SNR of 20dB, the eye is more closed than with an SNR of 70dB as
expected.


Figure 18 AWGN with a SNR of 70dB

Figure 19 SNR 20


Results
The results of this test are that the SNR, roll-off factor of the RC filter and the number of levels of the PAM
signal has an effect in the signal and the receiver chance to decode the signal properly.

For high roll-off factors the BW of the signal increases and the eye widens as can be seen in Figure 17. And as
well as there is more variation in the signal.

Figure 20 Alpha=0 in the left, Alpha=1 in the right
With higher order PAM we can see in Figure 19 that there are more openings for 8PAM there are 7 openings,
this are based on the M-PAM where the openings are (M-1).

Figure 21 8PAM eye diagram



In terms of the SNR we can see that the eye closes with lower SNR thus making it more difficult for the
receiver to recover the signal. Figure 19 shows the required SNR to achieve a symbol error for different levels
of PAM modulation.

Figure 22 symbol error probability for PAM signals with respect to SNR

The channel capacity C is an indication of error free communication if the transmitted signal is less than the
capacity of the channel:
C=B*(1+alpha)*(log2(SNR+1))
B is the M-PAM bandwidth,
Symbol rate R=1/Ts
Bit rate Tb=1/Tb
Time per symbol Ts=log2(M)*Tb
For 4-PAM:
R=1/ log2(4)*Tb
R=1/2Tb
If Tb=1 R=1/2
B=R/2
B=1/4
B is the bandwidth of the signal and it is the bit rate/2 and for 4-PAM is .

So we can see that the capacity of the channel gets affected by the alpha or roll of factor and the SNR apart
from the m-ary levels of the PAM modulation.
Rearranging the capacity equation we can calculate the required SNR for a given m-ary and alpha.
So for alpha=1 and m=4 the required SNR for a capacity of 2 to achieve free error communication is:
SNR_req=2^(2/(0.25*(1+1)))-1

So the minimum required SNR for a 4PAM is 15dB this will achieve a capacity of 2. And if alpha is 0.5 then the
required SNR is increased to 40dB this makes sense as the eye gets smaller and it is more difficult for the
receiver to recover the signal.



Digital Modulation
Aim and theory

The aim is to implement different digital modulation techniques:
ASK (Amplitude Shift Keying),
FSK (Frequency Shift Keying),
PSK (Phase Shift Keying).
Once they are generated we can analyze its spectrum in terms of BW and the complexity of the modulation.

Implementation

For repeatability the digital stream was fixed as a square wave, this means that there is the same number of
0 as 1 and they were alternating with the same period.
ASK
ASK modulation is achieved by multiplying the input stream by a cosine of the carrier. The output in the
Figure 23 comparing the input to the modulated signal. When the input is 1, the cosine wave passes to
output, when the input is 0 no signal appears at the output. This is the so called OOK (on-off keying).
As mention above for simplicity and repeatability the input bit stream consist in a square wave of 0 and 1
The carrier in this case is set to 1KHz and the input frequency is set to 100Hz.

i nput =squar e( 2*pi *f r eq_i np*t 1) ;
i nput =( i nput +1) / 2; %t o make t he si gnal pr esent bet ween 1 and 0.
car r i er =si n( 2*pi *F1*t 1) ;


Figure 23 ASK time domain


Figure 24 shows the ASK spectrum two sided spectrum done with the FFT of the signal and after that we
FFTSHIFT to place it like it should be displayed, with the main freq at 1KHz and the image in the negative
frequencies.
The second subplot is the logarithmic scale of the spectrum, it can be readjusted as the dominant parts are
reducing the resolution of the wanted signal.
pl ot ( f r eq_spaci ng, ( abs( f f t shi f t ( FSK) ) ) ) ;
semi l ogy( f r eq_spaci ng, ( abs( f f t shi f t ( ASK) ) ) , ' b' ) ;


Figure 24 ASK spectrum
The zoomed area of interest is shown in Figure 25, we can see that the carrier frequency is the dominant in
this case Fc was set to 1KHz and that to either side of the carrier we see the different data that we are
sending, in this case we were sending a square wave of 100Hz, so we can see that at 1.1KHz there is a
component and that at 0.9KHz there is another. If the input bit stream was a random stream then the
spectrum will be looking more like in Figure 26 with no clear frequency of the input stream.

Figure 25 zoomed ASK

Figure 26 random input bit stream

FSK
For implementing FSK, it is just input bit stream multiplied by a cosine of a frequency and the inverse of the
input bit stream by the cosine of a second frequency, then the results are added and the FSK modulation is
completed.
FSK_Mod=i nput . *car r i er ;
FSK_Mod_s=( 1- i nput ) . *car r i er 1;
FSK_Mod=FSK_Mod+FSK_Mod_s;

The modulation is done using 1KHz and 2KHz, and the resulting FSK modulated signal is shown in Figure 27.
Again for the input bit stream was a square wave at 100Hz.


Figure 27 FSK modulation in time domain

The spectrum of FSK modulation is shown in Figure 28 , it can be seen that the spectrum is composed by two
ASK spectrum centered at the two different carriers that were used to modulate the signal, and the BW will
depend on the separation of this two carriers, there is an special case of FSK called minimum shift keying
(MSK) with a frequency separation of 1/2Tb (Tb is the bit period).


Figure 28 FSK modulation spectrum

PSK
To generate PSK the input bit stream is multiplied by a carrier and the inverse of the input stream by another
carrier that is shifted by 180 degrees. The modulated signal is shown in Figure 29. When the input is 1, the
cosine wave of the carrier passes to output, when the input is 0 the same sine (or cosine with 180 degrees
phase) of the carrier frequency passes to output.
PSK_Mod=i nput . *car r i er ;
PSK_Mod3_s=( 1- i nput ) . *car r i er 2;
PSK_Mod=PSK_Mod+PSK_Mod3_s;

Figure 29 PSK modulation time domain



The spectrum of this modulation is shown in Figure 30 we can see a zoomed version in Figure 31 showing that
the carrier is not present and that the BW of the signal will be dependent on the frequency of the input bit
stream, as in the plot we can see that the frequency components appears at +- 100Hz from the carrier
frequency, another factor for the BW is the abruptness on the phase changes. One thing to note is that the
power it uses is quite high. The problem with this modulation is synchronization. As the level of modulation
increases, the power it uses increases and synchronization becomes hard.


Figure 30 PSK spectrum

Figure 31 PSK zoom spectrum


Results

For ASK we can see that the required BW for transmission is twice the occupied BW by the source baseband.
Thus the maximum BW efficiency is 1bit/seconds/Hz.

FSK Modulation scheme needs more bandwidth than any other modulation schemes, except for the MSK
case. It is a constant envelope modulation that is not affected to changes in amplitude.

PSK is the most complex modulation of the three.

It is possible to reduce the occupied BW of ASK and FSK by pulse shaping the input bit stream before this is
passed to the modulator with a raised cosine filter. And for the FSK the Gaussian filter might be used that
reduced the spectral occupancy and it is called GMSK that is used in the GSM systems.

You might also like