필터 지우기
필터 지우기

Why zero values in matrix

조회 수: 11 (최근 30일)
Milan
Milan 2022년 10월 30일
댓글: Stephen23 2022년 10월 30일
%hello, here eventhough matrix components are not zero, I am getting zero values when I put A a very large number. %Is there any way to avoid such?
E = 1;
I_z = 1;
%E_Iz = E*I_z;
R = 1;
L = R; %R
%A = 1;
A = 10^9; %so that axial strain is very small
% K1 = A*E/L;
% K2 = 12*E*I_z/L^3;
% K3= 6*E*I_z/L^2;
% K4 = 4*E*I_z/L;
% K5 = 2*E*I_z/L;
% for element 1
Ke_1_local = [A*E/L 0 0 -A*E/L 0 0;
0 12*E*I_z/L^3 6*E*I_z/L^2 0 -12*E*I_z/L^3 6*E*I_z/L^2;
0 6*E*I_z/L^2 4*E*I_z/L 0 -6*E*I_z/L^2 2*E*I_z/L;
-A*E/L 0 0 A*E/L 0 0;
0 -12*E*I_z/L^3 -6*E*I_z/L^2 0 12*E*I_z/L^3 -6*E*I_z/L^2;
0 6*E*I_z/L^2 2*E*I_z/L 0 -6*E*I_z/L^2 4*E*I_z/L ]
Ke_1_local = 6×6
1.0e+09 * 1.0000 0 0 -1.0000 0 0 0 0.0000 0.0000 0 -0.0000 0.0000 0 0.0000 0.0000 0 -0.0000 0.0000 -1.0000 0 0 1.0000 0 0 0 -0.0000 -0.0000 0 0.0000 -0.0000 0 0.0000 0.0000 0 -0.0000 0.0000

채택된 답변

Walter Roberson
Walter Roberson 2022년 10월 30일
편집: Walter Roberson 2022년 10월 30일
you overlooked the 1.0e+09 * at the top of the display. Those 0.0000 are not true zeros, they are 1.0e+09 * a number that is 0.0000 to four decimal places.
I suggest that you give the command
format long g
and then ask to display the matrix
  댓글 수: 3
Milan
Milan 2022년 10월 30일
I see, I tried it and it worked, thanks for your help!
Stephen23
Stephen23 2022년 10월 30일
"I mean for example value at 2, 2 is zero right..."
No, it is not. If the value is exactly zero then MATLAB displays it as "0". The trailing zero digits of "0.0000" tell us that value is not exactly zero, but that the trailing digits are zero when displayed with four digits after the decimal point.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by