Null after solving for unknowns by setting the matrix det as zero
Show older comments
Hi community,
I attach my code here. I try to solve kz by setting the matrix T_mat det as zero. val_arr_sol is the solution. But later when I wanted to get the null of matrix T_mat, it fails.
The reason is related to the low accuracy? How could I improve my method so that I can get the null of a matrix with higher accuracy towards zero determinant, such as 1e^-15?
Thanks in advance
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];
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
%% The result is:
eigen_vec_null_puzz
ans =
7.5827e-07
ans =
2×0 empty double matrix
ans =
-3.6005e-06
ans =
2×0 empty double matrix
ans =
-3.6005e-06
ans =
2×0 empty double matrix
ans =
7.5827e-07
ans =
2×0 empty double matrix
Answers (1)
Lingling Fan
on 20 May 2019
Edited: Lingling Fan
on 20 May 2019
Categories
Find more on Operators and Elementary Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!