|
39 | 39 | "outputs": [],
|
40 | 40 | "source": [
|
41 | 41 | "R = 1.5 # radius [m] of circular loudspeaker array\n",
|
42 |
| - "array = sfs.array.circular(N=64, R=R) # with N loudspeakers\n", |
| 42 | + "N = 64 # loudspeakers\n", |
| 43 | + "array = sfs.array.circular(N=N, R=R)\n", |
43 | 44 | "grid = sfs.util.xyz_grid([-2, 2], [-2, 2], 0, spacing=0.02)\n",
|
44 | 45 | "\n",
|
45 | 46 | "xs = -4, 0, 0 # virtual point source on negative x-axis\n",
|
|
59 | 60 | " sfs.plot2d.amplitude(p, grid, vmax=2, vmin=-2, ax=ax_amp)\n",
|
60 | 61 | " sfs.plot2d.level(p, grid, vmax=6, vmin=-6, ax=ax_lvl)\n",
|
61 | 62 | " sfs.plot2d.level_contour(p, grid, levels=[0], colors='w', ax=ax_lvl)\n",
|
| 63 | + " if xref.shape[0] != N:\n", |
| 64 | + " xref = np.broadcast_to(xref, (N, 3))\n", |
62 | 65 | " for ax in ax_amp, ax_lvl:\n",
|
63 | 66 | " sfs.plot2d.loudspeakers(array.x, array.n, selection, size=0.125, ax=ax)\n",
|
64 | 67 | " ax_lvl.scatter(*xref[selection, :2].T, marker='o', s=20, c='lightsalmon',\n",
|
|
174 | 177 | " omega, array.x, array.n, xs)\n",
|
175 | 178 | "p_point = sound_field(\n",
|
176 | 179 | " d * normalize_gain, selection, array, secondary_source,\n",
|
177 |
| - " grid, np.array([[0, 0, 0]]*array.x.shape[0]))" |
| 180 | + " grid, np.array([[0, 0, 0]]))" |
178 | 181 | ]
|
179 | 182 | },
|
180 | 183 | {
|
|
205 | 208 | " omega, array.x, array.n, xs, xref=xref)\n",
|
206 | 209 | "p_point = sound_field(\n",
|
207 | 210 | " d * normalize_gain, selection, array, secondary_source,\n",
|
208 |
| - " grid, np.array([xref]*array.x.shape[0]))\n", |
| 211 | + " grid, np.array([xref]))\n", |
209 | 212 | "\n",
|
210 | 213 | "# plot stationary phase rays\n",
|
211 | 214 | "# one ray connects the virtual source with one activate loudspeaker\n",
|
|
0 commit comments