close all
clear all
frequency = 3e9;
lambda = 3e8/frequency;
antenna_spacing = lambda/2;
x_number = 10; y_number = 10;z_number_total = [1,3,7,10];

for z_iter = 1:length(z_number_total)
    z_number = z_number_total(z_iter);
axis = cell(x_number*y_number*z_number,1);
for i = 1:x_number
    for j = 1:y_number
        for k = 1:z_number
            axis{(i-1)*y_number*z_number+(j-1)*z_number+k} = [i*antenna_spacing,j*antenna_spacing,k*antenna_spacing];
        end
    end
end

[kernel_matrix] = kernel_calculate(frequency,axis,"ball");

eigen_value = eig(kernel_matrix);
eigen_value = flip(eigen_value);
eigen_value = eigen_value/eigen_value(1);

x = 1:20:x_number*y_number*z_number;
if(z_iter==1)
    plot(x,eigen_value(1:20:end),'-s','color','red','Linewidth',1.5,'markersize',4)
elseif(z_iter==2)
    hold on
    plot(x,eigen_value(1:20:end),'-o','color','m','Linewidth',1.5,'markersize',4)
elseif(z_iter==3)
    hold on
    plot(x,eigen_value(1:20:end),'-+','color','green','Linewidth',1.5,'markersize',4)
elseif(z_iter==4)
    hold on
    plot(x,eigen_value(1:20:end),'-^','color','blue','Linewidth',1.5,'markersize',4)
end
end
grid on
xlabel('Eigenvalue Index','Interpreter','latex','FontSize',14);
ylabel('Eigenvalue','Interpreter','latex','FontSize',14);
legend('2d surface','3d 3-layer','3d 7-layers','3d 10-layers','Interpreter','latex')