### COMPSCI314 Assignment 1

assignment作业 – 这个项目是assignment代写的代写题目

Submit via the assignment dropbox: https://adb.auckland.ac.nz

#### Part 1 (12/120 marks)

For this part of the assignment, you will be working with the 16 QAM constellation diagram on slide 118:

Introduction: Remember that in quadrature amplitude modulation, we transmit a signal with frequency f consisting of a sine and a cosine component. The I and Q coordinates of the constellation points are simply peak amplitude voltages for the cosine and sine components, respectively. That is, a constellation point (i, q) is i volts from the Qaxis in the horizontal direction (positive voltages to the right, negative voltages to the left) and q volts from the Iaxis in the vertical direction (positive voltages to the top, negative voltages to the bottom). So the signal s at time t that represents the constellation point (i, q) is

```
s(t) = i*cos(2ft) + q*sin(2ft)
```

where f is the carrier frequency. We can also write this in polar coordinates:

```
s(t) = sqrt(i^2 +q^2 ) * sin(2ft+)
```

Here, sqrt(i^2 +q^2 ) is the distance (voltage) between the origin of the IQ coordinate system and is the angle between the positive Iaxis, the origin, and the constellation point, in radians (that is, has a value between 0 and 2 rather than 0 and 360 degrees).

We will now assume that the constellation point labelled 1100 has the amplitude coordinates (1, 3) at the transmitter, i.e., 0111 has (1, 1), 1010 has (3, 3), and so on.

Your first task is to encode the last six digits of your AUID (7 or 9 digit student ID number) from 8 bit ASCII binary into 16QAM coordinate pairs (most significant bit first). E.g., the bit sequence 101101100010 would turn into:

(3, 1) // for 1011 (1, 3) // for 0110 (3, 3) // for 0010

…

Two marks will be awarded for each correct coordinate pair (you may include comments as to which pair relates to which bit sequence, but this is not required). You may use the ASCII table at [http://www.asciicode.com/ for conversion of your AUID digits into binary. ](http://www.asciicode.com/ for conversion of your AUID digits into binary. )

#### Part 2 (24/120 marks)

In this part, your task is to decode a 16QAM signal. The signal will be given to you as the I and Q voltages of the successive constellation points in the message. Download your personal sequence of constellation points from:

https://www.cs.auckland.ac.nz/courses/compsci314s2c/assignments/ulrich/noisyqam.php

As before in Part 1, each constellation point is a tuple (i,q) with two voltages. The receiver has amplified the voltages to the original levels. However there is some added noise on the voltages in the tuples. This noise may sometimes cause you to identify the wrong constellation point, which results in a symbol error (wrong ASCII character being decoded). Your task is to decode the raw message and identify and correct the symbol errors.

In your solution, identify the 4bit string (nibble) that each tuple decodes to, and the ASCII symbol that each byte resulting from two nibbles corresponds to. If the ASCII symbol is not printable, mark it as [NP] instead, or if it is a space character, mark it as [ ]. The original message consists of spaces and printable letters only. If the decoded character is in error, give the intended character as well, and identify the bit in error. Examples:

(0.85, 1.17) decodes as 0111 (2.91, 3.02) decodes as 1010 together, 01111010 gives z

(2.81, 2.94) decodes as 0010 (3.18 ,3.05) decodes as 0000 together, 00100000 gives [ ]

(2.02, 2.94) decodes as 0010 (1.02, 2.79) decodes as 0100 together, 00100000 gives $ Probable error in most significant nibble, probable intended bit sequence: 01100100 d

Finally, state the decoded message:

```
With symbol errors (characters in error) included, and
with symbol errors corrected.
```

Marking: 12 marks for correct decoding of the constellation points into bytes and conversion into ASCII, 6 marks for correct identification of the bit errors, and 6 marks for the correction of the resulting symbol errors.

#### Part 3 (48/120 marks)

In this part, your task is to convert decibel figures into (approximate) power ratios, and to give approximate decibel figures (rounded to the nearest dB) for a given power ratio. In doing so, you may wish to consider:

```
The rule that the logarithm of a product of two numbers x and y is the same as the sum of
the logarithms of x and of y.
That a power ratio of 2 is roughly +3 dB (and, similarly, a power ratio of 0.5 is approximately
3 dB)
That a power ratio of 10 is exactly +10 dB (and a power ratio of 0.1 is 10 dB)
The logarithm function is not particularly sensitive to small changes in its argument,
meaning that power rat ios can be rounded up or down a little without actually changing the
result in (whole) dB.
That the power ratio is the square of the corresponding voltage ratio.
```

To download your own personalised set of problems for this questions, go to: https://www.cs.auckland.ac.nz/courses/compsci314s2c/assignments/ulrich/decibels.php

Your task is to do these conversions **without a calculator** . This is actually pretty easy, as shown in the lectures and in the three examples below. Each question carries equal marks.

**Example 1** : 53 dB correspond to a power ratio of …?

*Answer* : dB figures are additive, so 53 dB = 50 dB + 3 dB. By the power formula, X0 dB (where X stands for the digits of an integer) corresponds to a ratio of 10 X:1 Here, X=5, so the ratio contributed by the 50 dB is 100000:1. The 3 dB correspond to a ratio of 2:1. Going from decibels to actual ratios mean that we take the product rather than the sum, so the ration we are looking for is 200000:1. The sort of answer wed be looking for here can be shorter as long as it shows your working, e.g., as shown here in **bold** :

**53 dB = 50 dB + 3 dB = 100000 * 2 = 200000** .

**Example 2** : A power ratio of 0.05 corresponds to … dB?

*Answer* : 0.05 is 0.1 * 0.5. 0.1 corresponds to 10 dB and 0.5 (see above) to 3 dB. Add and obtain: 13 dB. A satisfactory answer in your submission would be: **0.05 = 0.1 * 0.5 = 10 dB 3 dB = 13 dB** .

**Example 3** : A power ratio of 0.00045 corresponds to … dB? _Answer: _ **_0.00045 ~= 0.0005 = 0.001 / 2 = 30 dB 3 dB = 33 dB _** Note this is an example of rounding thats perfectly acceptable. Why? Consider which power ratios 32 dB and 34 dB correspond to!

#### Part 4 (36/120 marks)

In this part, your task is to apply the ShannonHartley capacity theorem.

There are two versions of the theorem:

```
1) C = B log 2 (S/N+1) (precise version)
2) C = B log 2 (S/N) (approximate version for S/N much larger than 1)
```

Here, C is the capacity of the channel (its theoretically achievable maximal bit rate in bits/second), B is the bandwidth in hertz, S is the signal power in watts and N is the noise power, also in watts. S/N is also called the signaltonoise ratio.

You may use the approximate version of the theorem for S/N > 30.

For this part, download your personalised question set from the same URL as above:

https://www.cs.auckland.ac.nz/courses/compsci314s2c/assignments/ulrich/decibels.php

Units in the question set may have the usual multiplier prefixes attached, e.g., mW = milliwatts or Mb/s = megabits/second. For test and exam, we expect you to be familiar with them and how to convert between them (e.g., between mm and km):

**Prefix Prefix name Multiplier Example ** f femto… 10 15 fW (femtowatts) p pico… 10 12 pW (picowatts) n nano… 10 9 ns (nanoseconds) micro… 10 6 W (microwatts) m milli… 10 3 mm (millimetres) k kilo… 103 kHz (kilohertz) M mega… 106 Mb (megabits) G giga… 109 GHz (gigahertz) T tera… 1012 TB (terabytes)

You may use a calculator where this is appropriate, however you are expected to:

```
1) Show your working. We dont just want to see the result, but also how you got there.
2) Use appropriate rounding: The result should not be accurate to more significant digits than
any of the input quantities, and do keep in mind the behaviour of the log function please.
E.g., for the purposes of this assignment:
12.3 log 2 (345.6789) = 12.3 log 2 (345.1234) = 103.7
Marks will be awarded for proper numerical presentation!
```

Each question carries up to 10 marks for technical correctness and up to 2 marks for proper numerical presentation.