0% found this document useful (0 votes)
167 views9 pages

Waveform Generation for NRZ and RZ

The document describes experiments to generate time domain waveforms for various line coding schemes including NRZ, RZ, BPSK, QPSK, and 16-QAM. Random bit sequences are generated as input and mapped to output amplitude levels according to each scheme. For all schemes, MATLAB code uses a time index variable and for loop to map input bits to amplitude values over time, generating the desired waveforms. Key steps and equations for obtaining each type of waveform are provided.

Uploaded by

ASHIRWAD RAY
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)
167 views9 pages

Waveform Generation for NRZ and RZ

The document describes experiments to generate time domain waveforms for various line coding schemes including NRZ, RZ, BPSK, QPSK, and 16-QAM. Random bit sequences are generated as input and mapped to output amplitude levels according to each scheme. For all schemes, MATLAB code uses a time index variable and for loop to map input bits to amplitude values over time, generating the desired waveforms. Key steps and equations for obtaining each type of waveform are provided.

Uploaded by

ASHIRWAD RAY
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

EXPERIMENT -1

Generate time domain waveforms for a random bit sequence for the following:
NRZ, RZ polar, RZ unipolar, BPSK, QPSK, QAM.

FOR NRZ POLAR, NRZ UNIPOLAR

1. Description of the input

Randomly 20 binary sequences are generated by the use of the command ‘randi’
in the MATLAB code. It is all either 1’s or 0’s. This is applicable for both NRZ
polar and NRZ unipolar line coding scheme.

2. Description of the output

For NRZ Polar Line coding, all 1’s is mapped to +1 amplitude level and 0’s are
mapped to -1 amplitude level for the entire symbol duration of Tb.

For NRZ Unipolar line coding, all 1’s is mapped to +1 amplitude level and 0’s
are mapped to 0 amplitude level for the entire bit duration.

3. All required waveforms or numerical results


4. How the waveforms or numerical results were obtained briefly
 In the code provided, time axis is defined as

t=0:0.01:length(x);
 Here ‘x’ is the input bits generated of length = 20. So it will print as :
t= 0, 0.01, 0.02, 0.03, 0.04 upto 20.

 In MATLAB, it is t(1) =0 ; t(2) = 0.01; t(3) = 0.02 and so on.


A variable is defined for indexing purpose (in code it is defined as 1).

%NRZ Pulse Shaping


b=1; % for indexing purpose
t=0:0.01:length(x);
for j=1:length(t)
if t(j)<=b
y(j)=p(b);
else
y(j)=p(b);
b=b+1;
end
end
The for loop starts from j =1 , 2, 3,….

 For j=1, it will take t(1) that is value = 0 and it will compare with the
value of b , which is 1. As this condition satisfies, it will take output y(1)
= p(1) = which stores the value of 1st bit in the randomly generated
sequence (either 0 or 1).

 Again for j=2, it will take t(2) that value is 0.01 which is still less than the
value of b (that is 1). The condition is satisfied and it takes output y(2) =
p(1) = the same value as previous .

 In this way, from 0 to 1, it will store same amplitude level ‘y’, be it either
0 or 1 based on randomly generated bits.

 The amplitude level will change when for example – j = 1.01 <=1(the
value of b), it will increment the value of b ; (from the line b=b+1 in the
code) to 2.

 This was the way the waveforms were generated in MATLAB.


FOR RZ POLAR, RZ UNIPOLAR

1. Description of the input

Randomly 20 binary sequences are generated by the use of the command ‘randi’
in the MATLAB code. It is all either 1’s or 0’s. This is applicable for both RZ
polar and NRZ unipolar line coding scheme.

2. Description of the output

For RZ Polar Line coding, all 1’s is mapped to +1 amplitude level for half bit
duration Tb ;whereas for other half it remains as 0 and 0’s are mapped to -1
amplitude level for the half bit duration of Tb.

if ‘1’ is transmitted

if ‘0’ is transmitted

For RZ Unipolar Line coding, all 1’s is mapped to +1 amplitude level for half
bit duration Tb ;whereas for other half it remains as 0 and 0’s are mapped to 0
amplitude level for entire bit duration of Tb.

if ‘1’ is transmitted

if ‘0’ is transmitted

3. All required waveforms or numerical results


5. How the waveforms or numerical results were obtained briefly
 In the code provided, time axis is defined as

t=0:0.01:length(x);
 Here ‘x’ is the input bits generated of length = 20. So it will print as :
t= 0, 0.01, 0.02, 0.03, 0.04 upto 20.

 In MATLAB, it is t(1) =0 ; t(2) = 0.01; t(3) = 0.02 and so on.


A variable is defined for indexing purpose (in code it is defined as 1).
xn1 =[ ]; %empty matrices intialized to store two values
for i = 1:N
if(x(i)==1)
xn = [1 0]
else
xn = [-1 0]
end
xn1 = [xn1 xn]
end
 This program will work in the same manner as that for the NRZ case.
 The only difference is for inputs ‘1’, it takes sequence = [1 0] as
mentioned in the above code for RZ polar and similarly for ‘0’, it takes
sequence = [-1 0] for RZ polar and [0 0] sequence for RZ unipolar case.
FOR BPSK

1. Description of the input

Randomly 20 binary sequences are generated by the use of the command ‘randi’
in the MATLAB code. It is all either 1’s or 0’s.

2. Description of the output

There is a phase change of 180o in every transition from either 0 to 1 or 1 to 0.

3. All required waveforms or numerical results

4. How the waveforms were obtained briefly


 A random input bit stream of 20 was generated
 It is then NRZ polar mapped, such that it will have amplitude levels as +1
and -1.
 From the theory of representation of BPSK signals in signal space:

If ‘1’ is transmitted

If ‘0’ is transmitted
 From the above expressions, we can say a carrier signal is multiplied with
a positive amplitude level if ‘1’ is transmitted, else it is multiplied with a
negative amplitude of same value if ‘0’ is transmitted.
 The 3rd subplot shows the required waveform for BPSK signal.

FOR QPSK

1. Description of the input

Randomly 10 binary sequences are generated by the use of the command ‘randi’
in the MATLAB code. It is all either 1’s or 0’s. It is mapped to +1 and -1.

2. Description of the output

There is a phase change of 180 o in every transition from either 0 to 1 or 1 to 0 of


two even and odd sequence when multiplied with a carrier cosine and sine
signal resulting in a BPSK signal.

3. All required waveforms or numerical results


4. How the waveforms were obtained briefly
 The randomly generated information bit stream is first converted into a
non-return to zero waveform with +1 or -1 levels.
 This NRZ waveform is further de-multiplexed into even and odd bit
streams.
 Each of the even and odd bit streams are picked up from the original
information bit stream and is extended upto 2 sec.
 The even bit stream multiplied with cosine signal and odd bit stream
multiplied with sine signal, both of them is a typical case of BPSK signal.
 On further addition of those two BPSK signals yields a QPSK signal.
Even sequence (be) Inphase BPSK

QPSK
Input bits
Acos(2*pi*f*t)
NRZ Line coding Demultiplexed

Odd sequence (bo) Quadrature phase BPSK

Acos(2*pi*f*t)
FOR 16-ARY QAM

1. Description of the input

Randomly 40 binary sequences are generated by the use of the command ‘randi’
in the MATLAB code. It is all either 1’s or 0’s. It is mapped to +1 and 0
indicating the transmitted bit sequence amplitude.

2. Description of the output

There is a variation in phase and amplitude observed in the output waveform for
16- ary QAM signal.

3. All required waveforms or numerical results

4. How the waveforms were obtained briefly


 Each of the 4 bit combination i.e. from 0000 to 1111 points in the signal
space constellation diagram corresponds to 4 different amplitude levels .
Those are +A, +3A, -A, -3A where A = amplitude value.
 It has a 2 dimensional basis function: one is in-phase component and
another is quadrature phase component
 Those 16 points in the constellation space corresponds to different
amplitude points (AI, AQ) => (-1,-3),(-1,-1),(-1,1),(-1,3),..... and so on.
 Now multiplying the in-phase component of the transmitted bits with the
cosine signal and quadrature phase component multiplication with the
sine signal will yield a QAM signal according to following equation:

Common questions

Powered by AI

In BPSK, each transition from '0' to '1' or '1' to '0' induces a phase shift of 180 degrees in the carrier signal . This phase change means that a '1' bit corresponds to multiplying the carrier by a positive amplitude and a '0' bit by a negative amplitude of the same value . By using phase shifts, BPSK effectively transmits information through phase changes rather than amplitude or frequency changes, enhancing resilience to noise as signal integrity relies on the detected phase rather than the amplitude.

In MATLAB, NRZ line codes use an approach where each bit duration maintains a constant amplitude level, either +1 or -1 for NRZ polar or +1 or 0 for NRZ unipolar, by comparing the time axis to indexing variable 'b' . Conversely, RZ line codes create a waveform such that a '1' maps to a sequence [1 0] and a '0' to [-1 0] for RZ polar and [0 0] for RZ unipolar, effectively returning to zero mid-bit duration . This entails creating sequences of [amplitude zero] for each bit, thus adding more complexity to the coding implementation compared to the simple constant level of NRZ.

In BPSK, the binary sequence is directly mapped onto an NRZ polar line with +1 and -1 levels and then multiplied with the carrier signal, leading to a phase-altered carrier for each bit transition . In contrast, QPSK first demultiplexes the binary sequence into even and odd streams. These streams are then separately multiplied by cosine and sine components (respectively), resulting in in-phase and quadrature BPSK signals, which on summation yield the composite QPSK signal . This approach allows QPSK to double the bit rate over BPSK with the same bandwidth by encoding two bits per symbol.

RZ line coding offers the advantage of better synchronization because it includes a zero level for every bit period, which makes it easier to determine bit boundaries for signal recovery . However, this method typically consumes more bandwidth than NRZ since it uses a pulse for each (half) bit, increasing the frequency of signal transitions. Additionally, RZ coding can be less energy efficient, as it does not maintain a constant non-zero voltage level like NRZ, potentially reducing power efficiency in long transmissions.

NRZ polar line coding maps '1's to a +1 amplitude level and '0's to a -1 amplitude level for the entire symbol duration 'Tb' . This means that there is always a voltage change between different bits, allowing a clearer distinction between the two states. In contrast, NRZ unipolar line coding assigns '1's to +1 amplitude level and '0's to 0 amplitude level for the entire bit duration . The lack of a negative counterpart in unipolar coding can lead to issues like baseline wander, which is less of a problem in polar coding due to its bipolar nature.

The 2-dimensional basis function in 16-QAM involves separate in-phase and quadrature components, allowing for multiple unique combinations of amplitude and phase. This dual-component approach enables more efficient signal construction as it simultaneously varies both components to encode data, achieving higher spectral efficiency . The ability to represent multiple bit sequences with distinct amplitude and phase points in its signal space enhances the data throughput, making it advantageous for bandwidth-limited communication channels. Such efficiency, however, may come with increased complexity in terms of signal processing and error correction.

To achieve QPSK modulation from an NRZ signal, the initial NRZ waveform, mapped to +1 and -1, undergoes de-multiplexing into even and odd bit streams. Each even bit stream is then modulated with a cosine signal, while the odd bit stream is modulated with a sine signal, creating two separate BPSK signals . On combining these modulated streams, the QPSK waveform results in both phase modulation (180-degree phase shifts between transitions) and quadrature components, offering higher bit density and spectral efficiency compared to the original NRZ format alone.

A signal space constellation diagram visually represents the amplitude and phase shifts used in 16-ary QAM modulation. Each point in the diagram corresponds to a unique 4-bit combination, reflecting different amplitude levels such as (+A, +3A) or (-A, -3A). This visual representation helps in understanding how QAM modulates signals by mapping each bit sequence to distinct in-phase and quadrature components, thereby allowing more efficient use of the spectrum by conveying multiple bits per symbol through combined amplitude and phase information.

In QAM, both in-phase and quadrature components form the basis of its signal space, allowing it to represent multiple amplitude and phase combinations. Each 4-bit combination in 16-ary QAM, for instance, corresponds to specific points in the signal constellation such as (-1, -3) or (1, 3) by varying both amplitude and phase . The in-phase component modulates the carrier using a cosine signal, and the quadrature component uses a sine signal, resulting in a composite waveform that increases bandwidth efficiency and enables higher data rates by transmitting two bits per component phase shift.

Using MATLAB for waveform generation allows students and engineers to visualize and manipulate real-time signals, reinforcing theoretical concepts in digital modulation. For QPSK, MATLAB scripts can simulate the process of demultiplexing bit streams, combining in-phase and quadrature signals, and analyzing phase shifts, providing an interactive learning tool that clarifies complex mathematical models . This simulation aids in bridging the gap between abstract theory and practical applications by demonstrating signal characteristics such as phase transitions and bandwidth utilization in a controlled environment.

You might also like