aboutsummaryrefslogtreecommitdiffstats
path: root/notebooks
diff options
context:
space:
mode:
authorsara <sara.halter@gmx.ch>2021-11-22 20:18:46 +0100
committersara <sara.halter@gmx.ch>2021-11-22 20:18:46 +0100
commitd050e5b5e74d4f1938edbc0599e3ce9597081e66 (patch)
tree0846ad080c427aab1156f9509d973e68ded2ed17 /notebooks
parentRename files (they had flipped names) (diff)
downloadFading-d050e5b5e74d4f1938edbc0599e3ce9597081e66.tar.gz
Fading-d050e5b5e74d4f1938edbc0599e3ce9597081e66.zip
Eignere Block FIR Filer
Diffstat (limited to 'notebooks')
-rw-r--r--notebooks/FIR_mehrere.ipynb66
1 files changed, 53 insertions, 13 deletions
diff --git a/notebooks/FIR_mehrere.ipynb b/notebooks/FIR_mehrere.ipynb
index 0bf0e1b..1be4234 100644
--- a/notebooks/FIR_mehrere.ipynb
+++ b/notebooks/FIR_mehrere.ipynb
@@ -17,7 +17,7 @@
"source": [
"import numpy as np \n",
"from numpy.fft import fft,ifft,fftshift\n",
- "import matplotlib.pyplot as plt"
+ "import matplotlib.pyplot as plt\n"
]
},
{
@@ -93,7 +93,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
- "/tmp/ipykernel_5041/4026507591.py:1: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray\n",
+ "/tmp/ipykernel_2862/4026507591.py:1: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray\n",
" np.array(x)\n"
]
},
@@ -191,36 +191,76 @@
},
{
"cell_type": "code",
- "execution_count": 11,
- "id": "de264619",
+ "execution_count": 12,
+ "id": "efc93b69",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "delay = 3.4\n",
+ "amplitude = .2\n",
+ "\n",
+ "d_int = int(np.floor(delay))\n",
+ "d_frac = delay - d_int\n",
+ "\n",
+ "h = np.concatenate([np.zeros(d_int-1), [amplitude], np.zeros(3)])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "id": "43372541",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "H_int = fft(h_int)\n",
+ "#H = H_int * np.exp(-1j*d_frac)\n",
+ "h = ifft(H_int)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 13,
+ "id": "a32cb580",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
- "0.25"
+ "<StemContainer object of 3 artists>"
]
},
- "execution_count": 11,
+ "execution_count": 13,
"metadata": {},
"output_type": "execute_result"
+ },
+ {
+ "data": {
+ "image/png": "iVBORw0KGgoAAAANSUhEUgAAAW4AAAD4CAYAAADM6gxlAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAsTAAALEwEAmpwYAAAU+klEQVR4nO3df2wkZ33H8c+XjQ/2QlJTsgW8Ib2kQpZKrsXIor1ehWj4YWgRcU/9kSAqCqruVNEWqsppzB8N/6CLaorgj4LqEiAIOI5eHBPxyyClNAW1OXxxdE6TbgshmKxDbtNoIWkXzmd/+4d3j/the2f2ZmbnmX2/pCj2eNbzfeaZ+Xhvnpl9zN0FAAjHc/pdAAAgHoIbAAJDcANAYAhuAAgMwQ0AgbksjV961VVX+Z49e9L41QBQSCdOnHjK3StR1k0luPfs2aPFxcU0fjUAFJKZfT/qulwqAYDAENwAEBiCGwACQ3ADQGAIbgAITKS7SszsLyX9iSSXtCzpHe7+kzQLy4v5pbpmFmpabbY0MlzW1MSoJseq/S4LMdGPKJKu77jNrCrpLySNu/v1kkqSbkq7sDyYX6prem5Z9WZLLqnebGl6blnzS/V+l4YY6EcUTdRLJZdJKpvZZZJ2S1pNr6T8mFmoqbW2ft6y1tq6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+nt7a/fLukLfawlc53QavtdFbT/zcwk3SHpEXf/4Dk/Knz/b9f2Xvo+F3eVSPEnJC4SM7tOm++ypc15QD9b5Pab2RFJr9Hmx1k+Kek2SfOSPi/pGkkrkn7f3Qs5gLdN+1+jzX8qu6THJB3qXPMtEjP7TUn/KmlZ0kZ78Xu1ea230P2/Q9tvVsy+z01wAwCiyculEgBARAQ3AASG4AaAwBDcABAYghsAAkNwA0BgCG4ACMz/A4iPWGs+fJWAAAAAAElFTkSuQmCC\n",
+ "text/plain": [
+ "<Figure size 432x288 with 1 Axes>"
+ ]
+ },
+ "metadata": {
+ "needs_background": "light"
+ },
+ "output_type": "display_data"
}
],
"source": [
- "sample_rate= 32e3\n",
- "nsample= 4 \n",
- "t = 1 / nsample "
+ "test = np.random.randint(0, 10, size = 20)\n",
+ "y = np.convolve(test, h)\n",
+ "\n",
+ "plt.stem(test, linefmt=\"C0-\")\n",
+ "plt.stem(y, linefmt='C1-')"
]
},
{
"cell_type": "code",
"execution_count": null,
- "id": "efc93b69",
+ "id": "e7b9d068",
"metadata": {},
"outputs": [],
- "source": [
- "f_tabs = np.exp((-2j*np.pi*t))"
- ]
+ "source": []
}
],
"metadata": {