forked from kfoysalhaque/Wi-BFI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot_vmatrices.py
99 lines (75 loc) · 3.54 KB
/
plot_vmatrices.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
"""
Copyright (C) 2023 Khandaker Foysal Haque
contact: haque.k@northeastern.edu
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import numpy as np
import matplotlib.pyplot as plt
V_k = np.load("vmatrix/V_ax_su_4x2_160.npy")
V_k = V_k[3:4, :, :]
V_k_squeezed= np.squeeze(V_k)
V_k_0= V_k_squeezed[:, 0, :]
V_k_1= V_k_squeezed[:, 1, :]
V_k_2= V_k_squeezed[:, 2, :]
V_k_3= V_k_squeezed[:, 3, :]
x = range(V_k_0.shape[0])
fig, ax = plt.subplots(2, 2)
ax[0, 0].plot(x, np.abs(V_k_0[:, 0]))
ax[0, 1].plot(x, np.abs(V_k_0[:, 1]))
ax[1, 0].plot(x, np.abs(V_k_1[:, 0]))
ax[1, 1].plot(x, np.abs(V_k_1[:, 1]))
ax[0, 0].set_xlabel('Sub-channel Index', fontsize=13)
ax[0, 1].set_xlabel('Sub-channel Index', fontsize=13)
ax[1, 0].set_xlabel('Sub-channel Index', fontsize=13)
ax[1, 1].set_xlabel('Sub-channel Index', fontsize=13)
ax[0, 0].set_ylabel(r'$\tilde{V}_{k}$ Magnitude', fontsize=12)
ax[0, 1].set_ylabel(r'$\tilde{V}_{k}$ Magnitude', fontsize=12)
ax[1, 0].set_ylabel(r'$\tilde{V}_{k}$ Magnitude', fontsize=12)
ax[1, 1].set_ylabel(r'$\tilde{V}_{k}$ Magnitude', fontsize=12)
ax[0, 0].set_title(r'$m=1$ & $n_{ss}=1$', fontsize=12)
ax[0, 1].set_title(r'$m=2$ & $n_{ss}=1$', fontsize=12)
ax[1, 0].set_title(r'$m=1$ & $n_{ss}=2$', fontsize=12)
ax[1, 1].set_title(r'$m=2$ & $n_{ss}=2$', fontsize=12)
ax[0, 0].tick_params(axis='y', labelsize=12) # Fontsize of x-axis tick labels
ax[0, 1].tick_params(axis='y', labelsize=12) # Fontsize of x-axis tick labels
ax[1, 0].tick_params(axis='y', labelsize=12) # Fontsize of x-axis tick labels
ax[1, 1].tick_params(axis='y', labelsize=12) # Fontsize of x-axis tick labels
ax[0, 0].grid()
ax[0, 1].grid()
ax[1, 0].grid()
ax[1, 1].grid()
xtick_locs = [0, 250, 500]
xtick_labels = ['0', '250', '500']
ytick_locs = [0.0, 0.50, 1]
ytick_labels = ['0.00', '0.50', '1.00']
ax[0, 0].set_xticks(xtick_locs) # Set the tick locations
ax[0, 0].set_xticklabels(xtick_labels, fontsize=12) # Set the tick labels
ax[0, 1].set_xticks(xtick_locs) # Set the tick locations
ax[0, 1].set_xticklabels(xtick_labels, fontsize=12) # Set the tick labels
ax[1, 0].set_xticks(xtick_locs) # Set the tick locations
ax[1, 0].set_xticklabels(xtick_labels, fontsize=12) # Set the tick labels
ax[1, 1].set_xticks(xtick_locs) # Set the tick locations
ax[1, 1].set_xticklabels(xtick_labels, fontsize=12) # Set the tick labels
ax[0, 0].set_yticks(ytick_locs) # Set the tick locations
ax[0, 0].set_yticklabels(ytick_labels, fontsize=12) # Set the tick labels
ax[0, 1].set_yticks(ytick_locs) # Set the tick locations
ax[0, 1].set_yticklabels(ytick_labels, fontsize=12) # Set the tick labels
ax[1, 0].set_yticks(ytick_locs) # Set the tick locations
ax[1, 0].set_yticklabels(ytick_labels, fontsize=12) # Set the tick labels
ax[1, 1].set_yticks(ytick_locs) # Set the tick locations
ax[1, 1].set_yticklabels(ytick_labels, fontsize=12) # Set the tick labels
# Add a legend
plt.legend()
plt.tight_layout()
plt.savefig('V_k.png', dpi=300, format='png')
# Display the plot
plt.show()