%close all
clear all
frequency_all = [1e9,3e9,6e9];
lambda_all = 3e8./frequency_all;
antenna_spacing_all = lambda_all/2;

for f_iter = 1:length(frequency_all)
    frequency = frequency_all(f_iter);
    antenna_spacing = antenna_spacing_all(f_iter);
    x_number = 9*frequency/3e9; y_number = 9*frequency/3e9;z_number = 9*frequency/3e9;
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);


if(f_iter==1)
    save_max_value = eigen_value(1);
else
    eigen_value = eigen_value*save_max_value/eigen_value(1);
end

if(f_iter==1)
    figure
    plot(1:216:27*216,eigen_value,'-s','color','red','Linewidth',1.5,'markersize',4)
elseif(f_iter==2)
    hold on
    plot(1:8:27*216,eigen_value,'-o','color','m','Linewidth',1.5,'markersize',4)
elseif(f_iter==3)
    hold on
    plot(1:27*216,eigen_value,'-+','color','blue','Linewidth',1.5,'markersize',4)
end
end
grid on
xlabel('number of eigenvalue','Interpreter','latex','FontSize',14);
ylabel('eigenvalue','Interpreter','latex','FontSize',14);
legend('$\Omega T = 2.5 \pi$','$\Omega T = 15 \pi$','$\Omega T = 45 \pi$','Interpreter','latex')