function [A,G,B,H]=mmwgeneratechannelmatrix(path,resolution,channelvariance,MSA,BSA)
%Millimeter wave channel model
%Returns the channel matrix of the size NBSXNMS
%Downlink communication (BSA to NSA)
%resolution is the number of AOD and AOA considered in the Dictionary.
%The distance between the antenna in the linear antenna array is considered
%as lambda/2
%MSA (Typical value = 32) is the number of mobile station antenna
%BSA (Typical value = 64) is the number of base station antenna
N=resolution;
L=path;
v=channelvariance;
angle=linspace(0,2*pi,N);
%D is the dictionary matrix with resolution N
A=[];
for i=1:1:MSA
A=[A; exp(j*pi*(i-1)*sin(angle))];    
end
B=[];
for i=1:1:BSA
B=[B; exp(j*pi*(i-1)*sin(angle))];    
end
%Variance of the real and imaginary part of the channel gain is considered
%as v
G=zeros(1,N);
temp=sqrt(v)*randn(1,L)+j*sqrt(v)*randn(1,L);
[a,b]=sort(rand(1,N));
G(b(1:1:L))=temp;
H=A*diag(G)*B';







