follow up:
I improved the code by putting the analytical solution function of the determinant inside the eigenvector null solver function. The det is closer to zero, about 1e^-15. But the null of the matrix is still empty.
%% test the eigen vector
clear;
epsxx = -1.7778;
epsyy = -2.1250;
epsyz = 0.0000 + 1.0417i;
kx = 0;
ky = -5;
k0 = 0.6000;
% val_arr_sol = [
% 0.0000 - 5.0636i
% 0.0000 - 5.0578i
% 0.0000 + 5.0578i
% 0.0000 + 5.0636i];
%% what if I solve for the problem once again and without any another transfer
val_arr_sol = eig_val_MO_x(epsxx, epsyy, epsyz, kx, ky, k0);
for i = 1:4
kz = val_arr_sol(i);
eps_mat = [epsxx, 0, 0;
0, epsyy, epsyz;
0, -epsyz, epsyy];
eta_mat = inv(eps_mat);
nabla_matrix = 1i*...
[0, -kz, ky;...
kz, 0, -kx;...
-ky, kx, 0];
rhs_matrix = [1, 0; 0, 1; -kx/kz, -ky/kz];
Tot_matrix = (nabla_matrix*eta_mat*nabla_matrix-k0^2*eye(3))*rhs_matrix;
T_mat = Tot_matrix(1:2, :);
det(T_mat)
null(T_mat)
end
%% results
%% test the eigen vector
ans =
-1.9425e-16
ans =
2×0 empty double matrix
ans =
-1.9425e-16
ans =
2×0 empty double matrix