├── Alt_CDM.m ├── Alt_SIC.m ├── README.md ├── WLLB.m ├── main.m └── spatial_channel.m /Alt_CDM.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shx-lyu/hybrid-precoding/2acb6efe0b7122db6cbbcdfb881ed79c9446b04d/Alt_CDM.m -------------------------------------------------------------------------------- /Alt_SIC.m: -------------------------------------------------------------------------------- 1 | % lattice-based alternating minimization+Babai(SIC) method 2 | % ref: Shanxiang Lyu, Zheng Wang, Zhen Gao, Hongliang He, Lajos Hanzo, "Lattice-Based mmWave Hybrid Beamforming", IEEE Transactions on Communications,2021 3 | % Author : Shanxiang Lyu (shanxianglyu@gmail.com, https://sites.google.com/view/shanx) 4 | % Date : 2020-June 5 | 6 | function [ FRF, FBB ] = Alt_SIC(Fopt,cons,NRF,iter) 7 | 8 | if nargin <=3 9 | iter=10; 10 | end 11 | 12 | [~,Nt]=size(Fopt'); 13 | %Alternating minimization 14 | FRF=2*randi([0,1],Nt,NRF)-ones(Nt,NRF);%Initialization 15 | for p=1:iter 16 | FBB=pinv(FRF)*Fopt; 17 | FT=Fopt.'; 18 | for k=1:Nt 19 | FRT(1:NRF,k)=SIC(FT(:,k),FBB.',cons); 20 | end 21 | FRF=FRT.'; 22 | end 23 | FRF=FRF/sqrt(Nt); 24 | FBB=pinv(FRF)*Fopt; 25 | end 26 | 27 | function [x_hat]=SIC(yy,H,cons) 28 | 29 | [M,N]=size(H); 30 | [Q,R2]=qr(H); 31 | 32 | if M>N 33 | Q1=Q(1:M,1:N); 34 | y=Q1'*yy; 35 | else 36 | y=Q'*yy; 37 | end 38 | R=R2(1:N,1:N); 39 | 40 | x_hat=zeros(N,1); 41 | for i=N:-1:1 42 | x_hat(i)=ClimbOne(y(i)/R(i,i),cons); 43 | if i>=2 44 | y=y-R(:,i)*x_hat(i); 45 | end 46 | end 47 | end 48 | 49 | function s_out=ClimbOne(s_in,cons) 50 | 51 | len=size(cons,2); 52 | 53 | s_com2=ones(1,len)*s_in; 54 | 55 | s_com=abs(cons-s_com2); 56 | 57 | ind=find(s_com==min(s_com)); 58 | 59 | if ~isempty(ind) 60 | s_out=cons(ind(1)); 61 | else 62 | s_out=1; 63 | end 64 | end 65 | 66 | 67 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # What it does 2 | The main function that draws the spectral efficiency versus SNR via 3 | different algorithms. 4 | 5 | The setting is in mmWave hybrid precoding using finite-resolution PSs. 6 | 7 | # Major algorithms 8 | 1. the lattice-based alternating minimization+Babai(SIC) method. 9 | 10 | ref: Shanxiang Lyu, Zheng Wang, Zhen Gao, Hongliang He, Lajos Hanzo, "Lattice-Based mmWave Hybrid Beamforming", IEEE Transactions on Communications, 2021. 11 | 12 | https://ieeexplore.ieee.org/document/9411813 13 | 14 | 2. the alternating minimization+CDM method 15 | 16 | ref: J. Chen, “Hybrid beamforming with discrete phase shifters for millimeter-wave massive MIMO systems,” IEEE Trans. Vehicular Technology, vol. 66, no. 8, pp. 7604–7608, 2017. 17 | 18 | 3. the WLLB method 19 | 20 | ref: Z. Wang, M. Li, Q. Liu, and A. L. Swindlehurst, “Hybrid precoder and combiner design with low-resolution phase shifters in mmwave MIMO systems,” J. Sel. Topics Signal Processing, vol. 12, no. 2, pp. 256–269, 2018. 21 | 22 | 4. the fully digital method 23 | 24 | # Author information 25 | Author: Shanxiang Lyu 26 | 27 | Associate Professor, Jinan University, Guangzhou 28 | 29 | Email: shanxianglyu@gmail.com 30 | 31 | Homepage: https://sites.google.com/view/shanx 32 | 33 | https://xxxy2016.jnu.edu.cn/Item/3636.aspx 34 | 35 | Date : 2020-June 36 | -------------------------------------------------------------------------------- /WLLB.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shx-lyu/hybrid-precoding/2acb6efe0b7122db6cbbcdfb881ed79c9446b04d/WLLB.m -------------------------------------------------------------------------------- /main.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shx-lyu/hybrid-precoding/2acb6efe0b7122db6cbbcdfb881ed79c9446b04d/main.m -------------------------------------------------------------------------------- /spatial_channel.m: -------------------------------------------------------------------------------- 1 | function [H]=spatial_channel(Nt ,Nr, Nc) 2 | % the function to generate the channel matrices in hybrid precoding 3 | % these codes are taken from: 4 | % https://github.com/yuxianghao/Alternating-minimization-algorithms-for-hybrid-precoding-in-millimeter-wave-MIMO-systems 5 | 6 | Nray = 10; % # of rays in each cluster % these are for channel generizations 7 | 8 | 9 | angle_sigma = 10/180*pi; %standard deviation of the angles in azimuth and elevation both of Rx and Tx 10 | 11 | gamma = sqrt((Nt*Nr)/(Nc*Nray)); %normalization factor 12 | sigma = 1; %according to the normalization condition of the H 13 | 14 | 15 | for c = 1:Nc 16 | AoD_m = unifrnd(0,2*pi,1,2);%uniform random AoD and AoA 17 | AoA_m = unifrnd(0,2*pi,1,2); 18 | 19 | AoD(1,[(c-1)*Nray+1:Nray*c]) = laprnd(1,Nray,AoD_m(1),angle_sigma); 20 | AoD(2,[(c-1)*Nray+1:Nray*c]) = laprnd(1,Nray,AoD_m(2),angle_sigma); 21 | AoA(1,[(c-1)*Nray+1:Nray*c]) = laprnd(1,Nray,AoA_m(1),angle_sigma); 22 | AoA(2,[(c-1)*Nray+1:Nray*c]) = laprnd(1,Nray,AoA_m(2),angle_sigma); 23 | end 24 | 25 | H = zeros(Nr,Nt); 26 | for j = 1:Nc*Nray 27 | At(:,j) = array_response(AoD(1,j),AoD(2,j),Nt); %UPA array response 28 | Ar(:,j) = array_response(AoA(1,j),AoA(2,j),Nr); 29 | alpha(j) = normrnd(0,sqrt(sigma/2)) + normrnd(0,sqrt(sigma/2))*sqrt(-1); 30 | H = H + alpha(j) * Ar(:,j) * At(:,j)';% Ar*At'!!! 31 | end 32 | H = gamma * H; 33 | 34 | end 35 | 36 | function y = laprnd(m, n, mu, sigma) 37 | %LAPRND generate i.i.d. laplacian random number drawn from laplacian distribution 38 | % with mean mu and standard deviation sigma. 39 | % mu : mean 40 | % sigma : standard deviation 41 | % [m, n] : the dimension of y. 42 | % Default mu = 0, sigma = 1. 43 | % For more information, refer to 44 | % http://en.wikipedia.org./wiki/Laplace_distribution 45 | 46 | % Author : Elvis Chen (bee33@sjtu.edu.cn) 47 | % Date : 01/19/07 48 | 49 | %Check inputs 50 | if nargin < 2 51 | error('At least two inputs are required'); 52 | end 53 | 54 | if nargin == 2 55 | mu = 0; sigma = 1; 56 | end 57 | 58 | if nargin == 3 59 | sigma = 1; 60 | end 61 | 62 | % Generate Laplacian noise 63 | u = rand(m, n)-0.5; 64 | b = sigma / sqrt(2); 65 | % y = mu - b.* sign(u).* log(1- 2.* abs(u)); 66 | y = mu + sign(u) .* ( pi - b.* log( exp(pi./b) + (2-2.*exp(pi./b)) .* abs(u) ) ); 67 | 68 | end 69 | 70 | function y = array_response(a1,a2,N) 71 | for m= 0:round(sqrt(N))-1 72 | for n= 0:round(sqrt(N))-1 73 | y(m*(round(sqrt(N)))+n+1) = exp( 1i* pi* ( m*sin(a1)*sin(a2) + n*cos(a2) ) ); 74 | end 75 | end 76 | y = y.'/round(sqrt(N)); 77 | end --------------------------------------------------------------------------------