clc; 
clear all
close all

M = 1; 
N = 512; % the number of the antennas at the BS

c = 3e8; %the speed of light

f = 60e9;
lambda = c/f; %the wave length
d = 0.5*lambda; % the antenna spacing lambda/2

Rayleigh_dis = 2 * (N*d)^2/lambda

delta = 0.25;
sample = 100;

SNR_dB = [-5:2:5];  
SNR_linear = 10.^(SNR_dB/10.);


range = 100;
grid_width = 10;
WBT_times = 2;
sample=39;
num_rf=100;
num_qua=5;
P1 = [0,range,-range,range];
Delta = [grid_width,grid_width];
[near_codebook,~] = generate_near_field_codebook(N,d,P1,Delta,lambda);


[~,~] = GSwb_design_withCIN(f,N,range,grid_width,near_codebook,WBT_times,sample,num_rf,num_qua);



range = 100;
grid_width = 5;
WBT_times = 2;
sample=140;
num_rf=100;
num_qua=5;
P1 = [0,range,-range,range];
Delta = [grid_width,grid_width];
[near_codebook,record] = generate_near_field_codebook(N,d,P1,Delta,lambda);
[~,~] = GSwb_design_withCIN(f,N,range,grid_width,near_codebook,WBT_times,sample,num_rf,num_qua);
% 
