Skip to content

Commit bef9f0c

Browse files
committed
signal eigendecomposition
1 parent f8c59c4 commit bef9f0c

File tree

2 files changed

+66
-7
lines changed

2 files changed

+66
-7
lines changed

examples/process_arma.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@
179179
"name": "python",
180180
"nbconvert_exporter": "python",
181181
"pygments_lexer": "ipython3",
182-
"version": "3.12.0"
182+
"version": "3.12.1"
183183
}
184184
},
185185
"nbformat": 4,

examples/signal_eigendecomposition.ipynb

Lines changed: 65 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": null,
5+
"execution_count": 10,
66
"metadata": {},
77
"outputs": [],
88
"source": [
9-
"import numpy as np"
9+
"import os, sys\n",
10+
"dir = os.path.abspath('../ssp')\n",
11+
"dir = os.path.dirname(dir)\n",
12+
"sys.path.append(dir)\n",
13+
"\n",
14+
"import numpy as np\n",
15+
"\n",
16+
"from ssp import spectrum"
1017
]
1118
},
1219
{
@@ -83,7 +90,7 @@
8390
"Let $ e_i $ be a column vector:\n",
8491
"\n",
8592
"$$\n",
86-
"e_i = [1, e^{j \\omega_i}, e^{j \\omega_i}, ..., e^{j (M-1) \\omega_i}] ^T\n",
93+
"e_i = [1, e^{j \\omega_i}, e^{j 2 \\omega_i}, ..., e^{j (M-1) \\omega_i}] ^T\n",
8794
"$$\n",
8895
"\n",
8996
"If we layout a new matrix with $ p $ many of $ e_i $ column vectors the result is a $ M $ x $ p $ matrix which we represent as:\n",
@@ -114,15 +121,67 @@
114121
"source": [
115122
"# Example of four sinusoids\n",
116123
"\n",
117-
"$ \\omega_k $ are $ 0.2\\pi, 0.3\\pi, 0.8\\pi, 1.2\\pi $ and the variance of white noise variance is $ \\sigma_w^2 = 0.5 $.\n",
124+
"$ \\omega_k $ are $ 0.2\\pi, 0.3\\pi, 0.8\\pi, 1.2\\pi $ and the variance of white noise variance is $ \\sigma_w^2 = 0.5 $. Number of samples is M = 64 $\n",
118125
"\n",
119-
"M = 64"
126+
"$$\n",
127+
"x(n) = \\sum_{k = 1}^{4} e^{j(n \\omega_k + \\phi_k)} + w(n)\n",
128+
"$$"
120129
]
130+
},
131+
{
132+
"cell_type": "code",
133+
"execution_count": 13,
134+
"metadata": {},
135+
"outputs": [],
136+
"source": [
137+
"R = 10\n",
138+
"N = 64\n",
139+
"nvar = 0.5\n",
140+
"wk = [0.2, 0.3, 0.8, 1.2]\n",
141+
"\n",
142+
"rng1 = np.random.default_rng()\n",
143+
"signoise = rng1.normal(0, np.sqrt(nvar), (R, N))\n",
144+
"\n",
145+
"rng2 = np.random.default_rng()\n",
146+
"phasek = rng2.uniform(0, 2 * np.pi, (R, N))"
147+
]
148+
},
149+
{
150+
"cell_type": "markdown",
151+
"metadata": {},
152+
"source": [
153+
"## Simulation\n",
154+
"\n",
155+
"For the Pisarenko method, a 5x5 autocorrelation matrix is estimated from the ten simulated 64-sample realizations.\n",
156+
"\n",
157+
"The other methods all use the samples as the 64x64 sampled matrix over 10 realizations."
158+
]
159+
},
160+
{
161+
"cell_type": "code",
162+
"execution_count": null,
163+
"metadata": {},
164+
"outputs": [],
165+
"source": []
121166
}
122167
],
123168
"metadata": {
169+
"kernelspec": {
170+
"display_name": ".env.py.312",
171+
"language": "python",
172+
"name": "python3"
173+
},
124174
"language_info": {
125-
"name": "python"
175+
"codemirror_mode": {
176+
"name": "ipython",
177+
"version": 3
178+
},
179+
"file_extension": ".py",
180+
"mimetype": "text/x-python",
181+
"name": "python",
182+
"nbconvert_exporter": "python",
183+
"pygments_lexer": "ipython3",
184+
"version": "3.12.1"
126185
}
127186
},
128187
"nbformat": 4,

0 commit comments

Comments
 (0)