Skip to content

Commit 443f34e

Browse files
committed
missed a transpose for 2d array plot
1 parent f5327e0 commit 443f34e

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

content/2d_beamforming.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Visualizing the beam pattern associated with these weights is a little more comp
130130
for j, phi_i in enumerate(phi_scan):
131131
a = steering_vector(pos, get_unit_vector(theta_i, phi_i)) # array factor
132132
results[i, j] = np.abs(w.conj().T @ a)[0,0] # power in signal, in dB
133-
plt.imshow(results, extent=(theta_scan[0]*180/np.pi, theta_scan[-1]*180/np.pi, phi_scan[0]*180/np.pi, phi_scan[-1]*180/np.pi), origin='lower', aspect='auto', cmap='viridis')
133+
plt.imshow(results.T, extent=(theta_scan[0]*180/np.pi, theta_scan[-1]*180/np.pi, phi_scan[0]*180/np.pi, phi_scan[-1]*180/np.pi), origin='lower', aspect='auto', cmap='viridis')
134134
plt.colorbar(label='Power [dB]')
135135
plt.scatter(theta*180/np.pi, phi*180/np.pi, color='red', s=50) # Add a dot at the correct theta/phi
136136
plt.xlabel('Azimuth angle [degrees]')

figure-generating-scripts/doa_2d.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def get_unit_vector(theta, phi): # angles are in radians
188188
for j, phi_i in enumerate(phi_scan):
189189
a = steering_vector(pos, get_unit_vector(theta_i, phi_i)) # array factor
190190
results[i, j] = np.abs(w.conj().T @ a)[0,0] # power in signal, in dB
191-
plt.imshow(results, extent=(theta_scan[0]*180/np.pi, theta_scan[-1]*180/np.pi, phi_scan[0]*180/np.pi, phi_scan[-1]*180/np.pi), origin='lower', aspect='auto', cmap='viridis')
191+
plt.imshow(results.T, extent=(theta_scan[0]*180/np.pi, theta_scan[-1]*180/np.pi, phi_scan[0]*180/np.pi, phi_scan[-1]*180/np.pi), origin='lower', aspect='auto', cmap='viridis')
192192
plt.colorbar(label='Power [dB]')
193193
plt.scatter(theta*180/np.pi, phi*180/np.pi, color='red', s=50) # Add a dot at the correct theta/phi
194194
plt.xlabel('Azimuth angle [degrees]')

0 commit comments

Comments
 (0)