Null after solving for unknowns by setting the matrix det as zero
이전 댓글 표시
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
답변 (1개)
Lingling Fan
2019년 5월 20일
편집: Lingling Fan
2019년 5월 20일
카테고리
도움말 센터 및 File Exchange에서 NaNs에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!