Homwork 1
Homwork 1
Coding
Coding involves converting data from its original form into a format that is more suitable for
transmission or storage. It is a general term that encompasses a variety of specific techniques.
Coding is used to transform the data into something that can be sent over communication
channels or stored in memory, often to ensure that it is error-resistant, compressed, or more
easily processed.
Hamming Code is a widely used error correction code that adds parity bits to data, allowing the
detection and correction of single-bit errors.
Example: If the transmitted codeword is 1001 and the received codeword is 1101, a parity check
can reveal the error, and the system can correct it.
Data Compression:
Huffman coding is a lossless data compression algorithm that reduces the size of data for
efficient storage or transmission. It assigns shorter codes to more frequent symbols and longer
codes to less frequent symbols.
2. Encoding
Encoding in the context of digital communication refers to the conversion of digital data (like
binary 1's and 0's) into signals that are suitable for transmission over a communication medium.
The format of the encoding depends on the characteristics of the medium (whether it's electrical,
optical, etc.) and the need for robustness against noise, interference, and other challenges.
Line Coding: Converts a stream of data bits into a continuous signal. Common examples include
NRZ (Non-Return-to-Zero), RZ (Return-to-Zero), and Manchester Encoding.
Block Coding: Groups bits into larger units (blocks) and encodes them into other units (typically
for error correction and to ensure data integrity).
Block coding can be used to add redundancy for error correction. For instance, the data 1011
might be encoded into a 7-bit codeword with additional parity bits, resulting in something like
1011010.
3. Modulation
Modulation involves changing the properties of a carrier signal (such as its amplitude, frequency,
or phase) to represent data in analog or digital form. It's essential for transmitting signals over
long distances, as raw digital data cannot directly propagate through typical transmission
mediums (e.g., air or cables) effectively.
AM varies the amplitude of a carrier wave in accordance with the input signal. The amplitude of
the carrier is proportional to the message signal's amplitude. The frequency and phase remain
constant.
FM varies the frequency of the carrier wave according to the input signal. This type of
modulation is resistant to amplitude noise and is typically used in radio broadcasting.
Example: FM radio, where the carrier's frequency shifts within a range to carry audio signals.
PM changes the phase of the carrier wave to represent data. It is closely related to FM but differs
in how the frequency is adjusted. The phase is modulated based on the data signal.
Example: Digital communication systems like PSK (Phase Shift Keying) use phase modulation
for representing binary data.
Quadrature Amplitude Modulation (QAM):
QAM combines both amplitude and phase modulation. It encodes data in the amplitude and
phase of the carrier signal. This allows higher data rates by transmitting multiple bits per symbol.
4. Demodulation
Demodulation is the reverse process of modulation. It’s the process of extracting the original
baseband signal (or information) from a modulated carrier signal. The goal is to recover the
transmitted data in a form that can be understood or processed.
AM Demodulation:
To demodulate an AM signal, a receiver detects the amplitude variations in the carrier wave.
This process typically uses a diode detector to recover the original message (e.g., audio signal).
FM Demodulation:
QAM Demodulation:
In QAM, the demodulator separates the amplitude and phase components of the signal. For
example, in 16-QAM, the signal might encode 4 bits per symbol. The demodulator maps the
received signal back to the corresponding bits by analyzing both the amplitude and phase.
5. Encryption
Encryption is the process of securing data by converting it into an unreadable format to protect
sensitive information. It's widely used in communication systems, online banking, e-commerce,
and anywhere data integrity and confidentiality are critical.
Symmetric Encryption:
In symmetric encryption, the same key is used to encrypt and decrypt data. Both the sender and
receiver need to share the secret key beforehand.
Example: AES (Advanced Encryption Standard), a block cipher, is used in many applications,
including SSL/TLS for secure internet communication.
Asymmetric Encryption:
Asymmetric encryption uses a pair of keys—public and private. The public key encrypts the data,
and only the corresponding private key can decrypt it. This is useful in scenarios like digital
signatures and secure communication.
Example: RSA is widely used in securing communications over the internet. The server has a
public key for encrypting data, and only the server (with the private key) can decrypt it.
Example: End-to-End Encryption (E2EE) in messaging apps like WhatsApp ensures that
messages are encrypted on the sender's side and only decrypted on the recipient's side,
preventing third parties (including the app provider) from reading the messages.
6. Unipolar Encoding
Unipolar encoding represents binary values using a single polarity. Typically, a "1" is
represented by a positive voltage, and a "0" is represented by zero voltage (0V). This is one of
the simplest forms of encoding.
The main problem with unipolar encoding is lack of synchronization—especially when long
sequences of zeros are transmitted, there are no transitions in the signal to synchronize the sender
and receiver.
Example:
1 → +5V
0 → 0V The signal would look like: +5V, +5V, 0V, +5V, 0V, +5V, 0V.
7. Bipolar Encoding
Bipolar encoding improves on unipolar encoding by alternating between positive and negative
voltages to represent binary "1"s, while using zero voltage for "0"s. This approach avoids the
long periods of constant voltage (which could lead to synchronization issues) and reduces the DC
component of the signal.
In Manchester, every bit has a transition in the middle (which implies a higher frequency), while
in bipolar, the signal alternates between positive and negative voltages for "1"s, and "0"s are
represented by zero voltage. Bipolar encoding can thus have lower bandwidth requirements than
Manchester encoding.
Example:
1 → +5V (first "1"), 1 → -5V (second "1"), 0 → 0V, 0 → 0V, 1 → +5V (third "1"), etc.
The signal would look like: +5V, -5V, 0V, 0V, +5V, -5V, 0V.
8. Manchester Encoding
Manchester Encoding is a form of encoding that not only represents the data but also encodes
clock information within the data signal itself. Each bit is represented by two voltage levels: a
transition at the middle of the bit period. This ensures synchronization without requiring a
separate clock signal, which is critical in many communication systems.
Property:
It’s a self-clocking scheme because the transitions themselves provide the timing information
necessary for the receiver to distinguish between bits.
Example:
1 → low-to-high transition
0 → high-to-low transition
1 → low-to-high transition
Encodin: Converting data into a form for transmission.Base64 encoding for email, Manchester
encoding for digital communication, NRZ for bit stream conversion.
Modulation: Modulating a carrier signal to carry the data over a communication medium (e.g.,
air, cables).
AM for radio transmission, FM for radio, QAM for digital transmission (e.g., cable TV, Wi-Fi).
Demodulation : Extracting original data from the modulated signal.AM radio receiver extracting
audio, FM demodulation in radio.
Encryption: Converting data into a secure form to prevent unauthorized access. AES for
securing files, RSA for public key encryption in web security.
Unipolar Encoding: Uses one voltage level to represent binary values, with a simple encoding
scheme.1 → +5V, 0 → 0V.
Bipolar Encoding: Alternates positive and negative voltages for binary 1s, with zeros represented
by 0V, to avoid long periods of zero voltage and help with error detection. 1 → +5V, 0 → 0V, 1
→ -5V, etc.
Manchester Encoding Every bit has a transition in the middle, ensuring synchronization and a
self-clocking signal. Logical 1 → low-to-high, Logical 0 → high-to-low.