# Channel estimation with OFDM random symbol

## Estimation, Synchronization, and Tips

Posted by Jingbiao on May 15, 2021, Reading time: 9 minutes.

$$\require{amstext} \require{amsmath} \require{amssymb} \require{amsfonts}$$

## Channel estimation

#### 1.Generate an n-length sequences of psuedo-random constellation values

• By means of psuedo-random, we can either use a known seed number in numpy for generating random numbers. Or we can simply taken some values of some digits of $\pi$

• My approach of doing this is to first generate a length of 12 random integers:

array([86, 35, 76, 39, 41, 46, 95, 38, 5, 63, 34, 95])

• Then turn this integer array (bytes) into binary strings:

'010101100010001101001100001001110010100100101110010111110010011000000101001111110010001001011111'

where the length of this binary strings should be 12 * 8 = 96

• Then use the helper function for turning binary codings into complex constellations (Here QPSK is used):

48 [(-1+1j), (-1+1j), (-1+1j), (1-1j), (1+1j)]

• By using random OFDM blocks and averaging over the channel estimation, you get better channel estimation.

#### 2.Take iDFT and add cyclic prefix to get the transmitted OFDM frames

where here prefix_no = 32

• Adding cyclic prefix is optional, the results should be the same.

#### 3.Then Transmit the sequence in a channel

Either turns the numpy array into a .wav file and send it to the phone and let the python program record the sound. See the synchronization implementation below. Or use a simulated channel to test the system if it works

• Use a linear convolution to convolve the transmitted OFDM frames with the simulated channel response to obtain the simulated received signal:

#### 4. Remove the cyclic prefix for the received signal and average the received signal

here since using a simulated channel, no noise, therefore averaging is not required

#### 6. Finally take the iDFT to get the impulse response of the channel

array([5.0e-01+3.8e-17j, 2.5e-01+5.9e-18j, 1.7e-17+4.3e-18j, 2.5e-01+6.5e-18j])

where this is very close to our initial simulated channel and we’ve proved this method works.

## Channel Synchronization

One of the most robust way of doing this is using chirps signal for synchronization:

#### 1. Generate a log chirp signal

Chirp is a sinusoidal signal that sweeps a range of frequencies. $$\textrm{chirp}(t) = \frac{1}{5}\sin\left{ 2\pi f_1 T * \frac{( f_2 / f_1)^\frac{t}{T} - 1}{\ln(f_2/f_1)}\right} \underbrace{(1- \exp^{-kt})(1-\exp^{k(t-T)})}_{\textrm{Exponential smoothing with }k=50}$$ where T is the duration and is set to 1 second, $f_1$ is the lower end frequency which is set to 100Hz and $f_2$ is the higher end frequency which is set to 10000Hz by standard. Additionally, the $1/5$ constant makes sure the magnitude of the chirp signal is similar to the OFDM symbols so that the chirp signal would not saturate the speaker and cause distortion to the higher amplitude signals.

#### 2. Concatenate the Known OFDM symbol with the chirp signal

where the frames is the known OFDM symbols for channel measurements and the data_tran is the actual file we needs to transfer.

#### 3. Peak detection with matched filter

By convolving the signal with matched filter - time inverse of the chirp signal, we would be able to get a peak at where the chirp signal ends.

With some further calculation, we can easily determine where the signal starts. Therefore, rough synchronization is achieved.

#### 4. Fine tuning the synchronization

• With the previous mentioned steps, a rough synchronization could be achieved. However, if better synchronization is desired, some fine tuning should be used.

• The method for fine tuning the synchronization is based on calculating a score for each of the impulse response with different offset and then select the one with the highest score.

• For showing that this method actually work, a figure for bit error rate against impulse score is plotted. Notice that since during actual transmission, you would not known the bit error rate, therefore by using bit error rate to choose impulse response is not valid.

• The following block shows the code for calculating the impulse score. A length of 80 samples is chosen here, however longer can be used for various channels.

## Tips for measurements

1. Use a single microphone single speaker system. With more than one speaker, the recorded sound might be interfered by different microphone
2. Try to place the microphone and the speaker directly facing each other.
3. Try to use full volume while playing the sound.

## Some channel measurements

Impulse response:

As you can see, there is this repeated small peaks at about every 500 samples. Some easy calculation can be done here:

$$500 / 44100 * 340 / 2 = 1.93m$$

Which says that there is this obstacles at about 2 meters away from the microphone, that is my ceiling.

Frequency response: This frequency response shows some insights of the channel and the microphone. Most microphone has the drop in response after about 12khz.