% fix random seed
rng(pi)
%% simluation on the SBL based IRS channel estimation with angle spread
% predefined values
ms_ante = 6; % the number of antennas at user equippment side
bs_ante = 16; % the number of antennas at bs
irs_ele = 16^2; % the number of irs elements
Res1 = 18; % the number of atoms in the dicitionay


K1 = 10; % the number of overhead w.r.t pilot signals
K2 = 10; % the number of overhead w.r.t reflecting pattern

angle_spread = 3; % the spread of angles in the domain of cos
angle = linspace(-1,1-2/Res1,Res1); 

SNRl = [5,10,15,20,25,30]; % in dB
SNRl_10 = 10.^(SNRl/10);

numItr = 150; % the number of alternative optimization iterations

% generate pilot signals and irs pattern
X = 1/sqrt(ms_ante)*pilot_gen(ms_ante,max(K1));
irs_pattern = 1/sqrt(irs_ele)*((rand(irs_ele,max(K2)) > 0.5)*2-1); 
%% simulation settings
AVG = 50;% the number of trials
%%
% results
% nmse
error = zeros(3,AVG,length(SNRl));
time = zeros(3,AVG,length(SNRl));
