# Clustering Approach for Reliable Wireless Communication
## 2 Materials and Methods
### Cluster Conception and Performance
Thus, the complex value spreading codes were converted into real values using \(2\times L\) length sequences as follows:  
\[s_{real}=\text{as }[\text{Real }(\text{s})\text{Imag }(\text{s})] \tag{8}\]  
This changed the correlation properties between the codes compared to Figure 3. The autocorrelation remains the same (diagonal values equal to 4), but the cross-correlation is lower on average, which means that more orthogonal sequences can result from this approach. For instance, in this case, any code is orthogonal with 15 other codes (cross-correlation equals the minimum value of 0), and any code has a low cross-correlation (equal to 1) with 26 others. Figure 4 displays the absolute value of the cross-correlation between the real value sequences. To overcome the limitation of \(k\)-means implementation that uses predefined distance metrics, a similar clustering algorithm (\(k\)-medoids) was investigated. It allows the use of any distance metrics, including one minus the normalized cross-correlation mentioned previously. Both \(k\)-means and \(k\)-medoids algorithms split the data into \(k\) mutually exclusive clusters by minimizing the distance from the points to the cluster center. Compared to \(k\)-means, which sets the cluster center as the mean of points, \(k\)-medoids sets it to the median of the points. Thus, in the \(k\)-medoids algorithm, the cluster center is one of the sequences from the cluster. The number of clusters, denoted by \(k\), required to group the sequences is unknown. To identify the optimum value, the sum of the sequences' distances to the cluster is computed and plotted for various numbers of clusters. The assumption is that the smaller the sum distance, the more correlated the sequences belonging to the same cluster. Figures 5 and 6 show the maximum sum distances across the clusters for various values of \(k\) for \(k\)-means and \(k\)-medoids implementations. Figure 4: Cross-correlation matrix for 64 spreading sequences (length 8). In the \(k\)-means algorithm, the maximum sum distance has a steep decrease between 1 and 10 clusters, and after \(k=20\), the decreasing rate is negligible. Yet, the \(k\)-medoids algorithm with the modified distance metric shows a faster distance decrease from 10 clusters, and the lowering rate reduces significantly. Therefore, grouping the sequences in more than 20 and 10 clusters, respectively, will lead to clusters with marginally higher correlated sequences. To support this affirmation, Figure 7 illustrates the plot of the minimum correlation between sequences of the same cluster, averaged across the clusters. The cross-correlation between complex-valued sequences within clusters increases exponentially with the number of clusters and begins to flatten once \(k\) exceeds 20 clusters. If 20 clusters are used, the minimum correlation between complex-valued sequences of various clusters is depicted in Figures 8 and 9. For the minimum value equal to 4, it can be assumed that the cluster contained a single sequence. The higher the minimum value, the more correlated the sequences of the same cluster. Given that the minimum cross-correlation is never equal to 0, the clusters do not contain orthogonal sequences. Note that, on average, \(k\)-medoids with the modified distance metric led to a higher correlation within clusters compared to \(k\)-means, where the correlation distance was applied to a length of 8 real sequences. Figure 5: Maximum sum distance of sequences within each cluster for the \(k\)-means algorithm. \[(s,c)=1-\frac{\left(s-\frac{\overrightarrow{s}}{s}\right)*\left(c-\frac{ \overrightarrow{c}}{\overrightarrow{c}}\right)^{H}}{\sqrt{\left(s-\frac{ \overrightarrow{s}}{s}\right)*\left(s-\frac{\overrightarrow{s}}{s}\right)^{ \prime}\sqrt{\left(c-\frac{\overrightarrow{c}}{c}\right)*\left(c-\frac{ \overrightarrow{c}}{\overrightarrow{c}}\right)^{H}}}} \tag{4}\]0 Maximum sum distance of sequences within each cluster for \(k\)-medoids algorithm.