diff --git a/README.md b/README.md index 890f4d5..3af29b3 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,9 @@ Where: - $b$ = the slope of the tangent plane in the y-axis - $\lambda$ = wavelength +The waves exiting the transducers will look something like this. + +[]() In the case for this project, the spacing between the sources is 10 mm wich is more than double the recommended wavelength so we expect some loss of energy through sidelobes. Even more so diagonally since the sources are placed in a rectangular grid and the diagonal spacing is 14.14 mm. Placing the sources in a hexagonal grid solves big diagonal spacing but this makes the design of the PCB more challanging. For this reason i opted to design a rectangular grid of sources anyway. diff --git a/animation_beam.gif b/animation_beam.gif new file mode 100644 index 0000000..f82ef4f Binary files /dev/null and b/animation_beam.gif differ diff --git a/simulation/animation_beam.gif b/simulation/animation_beam.gif new file mode 100644 index 0000000..1c29283 Binary files /dev/null and b/simulation/animation_beam.gif differ diff --git a/simulation/simulate.py b/simulation/simulate.py index 92cd445..2bb6288 100644 --- a/simulation/simulate.py +++ b/simulation/simulate.py @@ -22,10 +22,19 @@ plt.gca().set_axis_off() plt.subplots_adjust(top = 1, bottom = 0, right = 1, left = 0, hspace = 0, wspace = 0) plt.margins(0,0) -w = 0 -h = 30 +# calculate phases for a focal point +#w = 0 +#h = 30 +#ax.plot(N/2*(1 - w/axlim), N/2*(2-h/axlim), 'ro') +#x = np.linspace(min(sources), max(sources), len(sources)) +#pos = np.sqrt((-w - x)**2 + h**2)/8.575 + +# calculate phases for beamforming x = np.linspace(min(sources), max(sources), len(sources)) -pos = np.sqrt((-w - x)**2 + h**2)/8.575 +a = -0.04 +pos = (a*x)/(np.sqrt(1+a*a)) +a = a*10 + def update(p): ax.cla() @@ -42,13 +51,15 @@ def update(p): for s in sources: ax.plot(N/2*(1 - s/axlim), N-1, 'ro') - ax.plot(N/2*(1 - w/axlim), N/2*(2-h/axlim), 'ro') + arrow = [1, (1/a)] + normal = arrow/np.linalg.norm(arrow) + ax.arrow(N/2, N-1, normal[0]*500, normal[1]*500, color='#ff0000', capstyle='projecting', linewidth=4, head_width=10) #ax.set_title(f'f = {40} KHz') ax.set_aspect('equal') ax.axis('off') ani = FuncAnimation(fig = fig, func = update, frames=60, interval = 3/8.575) -ani.save('./animation.gif', writer='imagemagick', fps=30) +ani.save('./simulation/animation_beam.gif', writer='imagemagick', fps=30) #plt.show() \ No newline at end of file