aboutsummaryrefslogtreecommitdiffstats
path: root/notebooks/Fading.ipynb
blob: b7618cda4cb173166b02de81856d0db6a1e08b95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "e19197ba",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "\n",
    "import matplotlib.pyplot as plt\n",
    "import matplotlib.image as mpimg"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ea1a7a45",
   "metadata": {},
   "source": [
    "# Simple 2 tap fading"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "4465dcd9",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.collections.PathCollection at 0x7efdc8f89f10>"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD4CAYAAADvsV2wAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAcfklEQVR4nO3df2wc5Z0G8OfrZaOuc6ibKOGHl4TkqsgVuYDdWiQo/wBXMIRCtmlpQKBy1Ymo1fEHFFlyRNSEU9pEsq7ketcrl55QQaQQoOnWKGldSjjRi5ocDuvUuI3VQCHJGpW0wWlptsfG/t4f3g2b9czu7M7vmecjRfHujnfe8cw8884777wjqgoiIoq+Nr8LQERE3mDgEx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vgPgVgBXAbhbRK7ypniu6AfwsqouA/By+bWZG1S1K4x9mS2ut1sBLCv/2wDgu54W0mFNbKu/KK/XLlX9Z08L6bzvA7ilzueRWscMfBtU9TeqOt5gsmsBHFPVt1T1QwDPAljrfulcsxbAk+WfnwSQ9a8orrKy3tYCeEpnHASQFpHLvS6og6K2rTakqq8COF1nkkitYwa++zIATlS9Pll+L6wuVdV3AaD8/yUm0ymAn4nIYRHZ4FnpnGNlvUVt3VpdnutE5IiI/ERElntTNN9Eah3ziVcNiMjPAVxm8NEjqvpjK19h8F6g+8LWW+Ymvma1qk6IyCUAXhKRo+XaVFhYWW+hW7cNWFme1zEzVssHIrIGQA4zzR1RFal1zMBvQFU/Y/MrTgJYVPX6CgATNr/TVfWWWUR+LyKXq+q75VPb90y+Y6L8/3si8iPMNBeEKfCtrLfQrdsGGi6Pqv6p6ud9IvIfIrJAVcM4yJgVkVrHbNJx32sAlonIUhGZA+AuAIM+l8mOQQD3lX++D8CssxwRmSsiF1d+BnAzZi5wh4mV9TYI4EvlnhyrAJypNHeFVMNlFpHLRETKP1+LmQz5o+cl9U6k1jFr+DaIyOcA/BuAhQD2isiIqvaKSAeA/1LVNap6TkQeADAEIAHgCVUd87HYdm0H8JyI/COA4wDuBIDqZQZwKYAflXPhIgA/UNWf+lTelpitNxH5SvnzxwHsA7AGwDEAZwF82a/yOsHiMn8BwFdF5ByAIoC7NMS364vIMwCuB7BARE4C2AwgCURzHXNoBSKimGCTDhFRTDDwiYhigoFPRBQTDHwiophg4BMRxQQDn4goJhj4REQx8f/e2491ktiQEgAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "nsamples = 200\n",
    "samp_rate = 32e3\n",
    "\n",
    "# QPSK modulation\n",
    "samp_per_sym = 4\n",
    "symbol_map = {\n",
    "    0: 1 + 1j,\n",
    "    1: -1 + 1j,\n",
    "    2: -1 - 1j,\n",
    "    3: 1 - 1j,\n",
    "}\n",
    "\n",
    "# generate random data for testing\n",
    "data = np.random.randint(low=0, high=4, size=nsamples)\n",
    "\n",
    "# modulate and add AWGN\n",
    "noise = np.random.normal(0, .03, size=nsamples) + 1j * np.random.normal(0, .03, size=nsamples)\n",
    "sig = np.array(list(map(lambda v: symbol_map[v], data))) + noise\n",
    "\n",
    "# add 2 tap frequency selective channel\n",
    "delay = np.zeros(5 * samp_per_sym)\n",
    "one = np.array([1])\n",
    "taps = np.concatenate([one, delay, .2 * one])\n",
    "\n",
    "# apply channel\n",
    "sig_fading = np.convolve(sig, taps)\n",
    "\n",
    "# plot figure\n",
    "fig = plt.figure()\n",
    "plt.scatter(sig_fading.real, sig_fading.imag)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "db9b381c",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}