function [o,d,theta] = Rayleigh_channel(maxd, mind ,m,k)
% this function generates the channel gains for uplink and downlink
d = 1/2*((maxd+mind)+ (maxd-mind)*randn(m,1));
theta = rand(m,1)*360;
D = repmat (d,[1,k]);
x = randn(m,k);
y=randn(m,k);
rayleigh = 1/2*sqrt(x.^2 + y.^2);
o = rayleigh./(D.^4);