Stop Matlab ignoring numbers
이전 댓글 표시
Hello, my code is:
t=1;
h=6.626*10^-34;
e=2.718281828459;
l=1.757*10^-29;
m=1.652*10^-29;
n=0.8*m;
o=2*pi*395581*10^9;
p=2*pi*443941*10^9;
q=2*pi*48360*10^9;
w=1;
M=[0,(0.E-323+sqrt(-1)*0.132584E5),(0.E-323+sqrt(-1)*0.E-323),( ...
0.E-323+sqrt(-1)*(-0.132584E5)),0,0,(0.E-323+sqrt(-1)*0.E-323),0, ...
0;(0.E-323+sqrt(-1)*0.132584E5),(sqrt(-1)*(-1)).*((-1).*o+w),( ...
0.E-323+sqrt(-1)*0.E-323),0,(0.E-323+sqrt(-1)*(-0.132584E5)),0,0,( ...
0.E-323+sqrt(-1)*0.E-323),0;(0.E-323+sqrt(-1)*0.E-323),(0.E-323+ ...
sqrt(-1)*0.E-323),(sqrt(-1)*(-1)).*((-1).*p+w),0,0,(0.E-323+sqrt( ...
-1)*(-0.132584E5)).*e.^(sqrt(-1).*t.*((-1).*o+p+(-1).*q+w)),0,0,( ...
0.E-323+sqrt(-1)*0.E-323);(0.E-323+sqrt(-1)*(-0.132584E5)),0,0,( ...
sqrt(-1)*(-1)).*(o+(-1).*w),(0.E-323+sqrt(-1)*0.132584E5),( ...
0.E-323+sqrt(-1)*0.E-323),(0.E-323+sqrt(-1)*0.E-323),0,0;0,( ...
0.E-323+sqrt(-1)*(-0.132584E5)),0,(0.E-323+sqrt(-1)*0.132584E5),0, ...
(0.E-323+sqrt(-1)*0.E-323),0,(0.E-323+sqrt(-1)*0.E-323),0;0,0,( ...
0.E-323+sqrt(-1)*(-0.132584E5)).*e.^(sqrt(-1).*t.*(o+(-1).*p+q+( ...
-1).*w)),(0.E-323+sqrt(-1)*0.E-323),(0.E-323+sqrt(-1)*0.E-323),( ...
sqrt(-1)*(-1)).*((-1).*q+w),0,0,(0.E-323+sqrt(-1)*0.E-323);( ...
0.E-323+sqrt(-1)*0.E-323),0,0,(0.E-323+sqrt(-1)*0.E-323),0,0,( ...
sqrt(-1)*(-1)).*(p+(-1).*w),(0.E-323+sqrt(-1)*0.132584E5).*e.^( ...
sqrt(-1).*t.*(o+(-1).*p+q+(-1).*w)),(0.E-323+sqrt(-1)*0.E-323);0,( ...
0.E-323+sqrt(-1)*0.E-323),0,0,(0.E-323+sqrt(-1)*0.E-323),0,( ...
0.E-323+sqrt(-1)*0.132584E5).*e.^(sqrt(-1).*t.*((-1).*o+p+(-1).*q+ ...
w)),(sqrt(-1)*(-1)).*(q+(-1).*w),(0.E-323+sqrt(-1)*0.E-323);0,0,( ...
0.E-323+sqrt(-1)*0.E-323),0,0,(0.E-323+sqrt(-1)*0.E-323),(0.E-323+ ...
sqrt(-1)*0.E-323),(0.E-323+sqrt(-1)*0.E-323),0]
but my output is:
M =
1.0e+15 *
Columns 1 through 5
0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 - 0.0000i 0.0000 + 0.0000i
0.0000 + 0.0000i 0.0000 + 2.4855i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 - 0.0000i
0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 2.7894i 0.0000 + 0.0000i 0.0000 + 0.0000i
0.0000 - 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 - 2.4855i 0.0000 + 0.0000i
0.0000 + 0.0000i 0.0000 - 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
0.0000 + 0.0000i 0.0000 + 0.0000i -0.0000 - 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
Columns 6 through 9
0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
0.0000 - 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
0.0000 + 0.3039i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
0.0000 + 0.0000i 0.0000 - 2.7894i 0.0000 + 0.0000i 0.0000 + 0.0000i
0.0000 + 0.0000i -0.0000 + 0.0000i 0.0000 - 0.3039i 0.0000 + 0.0000i
0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
For example the second entry. It is not equal to 0. But in the output it is.How can I stop that ?
댓글 수: 4
KSSV
2022년 3월 10일
They are not zeros....See that a number 1.0e+15 is multiplied to every element.
"For example the second entry. It is not equal to 0. But in the output it is."
No, it is not equal to zero. Lets have a look at it:
t=1;
h=6.626*10^-34;
e=2.718281828459;
l=1.757*10^-29;
m=1.652*10^-29;
n=0.8*m;
o=2*pi*395581*10^9;
p=2*pi*443941*10^9;
q=2*pi*48360*10^9;
w=1;
M=[0,(0.E-323+sqrt(-1)*0.132584E5),(0.E-323+sqrt(-1)*0.E-323),( ...
0.E-323+sqrt(-1)*(-0.132584E5)),0,0,(0.E-323+sqrt(-1)*0.E-323),0, ...
0;(0.E-323+sqrt(-1)*0.132584E5),(sqrt(-1)*(-1)).*((-1).*o+w),( ...
0.E-323+sqrt(-1)*0.E-323),0,(0.E-323+sqrt(-1)*(-0.132584E5)),0,0,( ...
0.E-323+sqrt(-1)*0.E-323),0;(0.E-323+sqrt(-1)*0.E-323),(0.E-323+ ...
sqrt(-1)*0.E-323),(sqrt(-1)*(-1)).*((-1).*p+w),0,0,(0.E-323+sqrt( ...
-1)*(-0.132584E5)).*e.^(sqrt(-1).*t.*((-1).*o+p+(-1).*q+w)),0,0,( ...
0.E-323+sqrt(-1)*0.E-323);(0.E-323+sqrt(-1)*(-0.132584E5)),0,0,( ...
sqrt(-1)*(-1)).*(o+(-1).*w),(0.E-323+sqrt(-1)*0.132584E5),( ...
0.E-323+sqrt(-1)*0.E-323),(0.E-323+sqrt(-1)*0.E-323),0,0;0,( ...
0.E-323+sqrt(-1)*(-0.132584E5)),0,(0.E-323+sqrt(-1)*0.132584E5),0, ...
(0.E-323+sqrt(-1)*0.E-323),0,(0.E-323+sqrt(-1)*0.E-323),0;0,0,( ...
0.E-323+sqrt(-1)*(-0.132584E5)).*e.^(sqrt(-1).*t.*(o+(-1).*p+q+( ...
-1).*w)),(0.E-323+sqrt(-1)*0.E-323),(0.E-323+sqrt(-1)*0.E-323),( ...
sqrt(-1)*(-1)).*((-1).*q+w),0,0,(0.E-323+sqrt(-1)*0.E-323);( ...
0.E-323+sqrt(-1)*0.E-323),0,0,(0.E-323+sqrt(-1)*0.E-323),0,0,( ...
sqrt(-1)*(-1)).*(p+(-1).*w),(0.E-323+sqrt(-1)*0.132584E5).*e.^( ...
sqrt(-1).*t.*(o+(-1).*p+q+(-1).*w)),(0.E-323+sqrt(-1)*0.E-323);0,( ...
0.E-323+sqrt(-1)*0.E-323),0,0,(0.E-323+sqrt(-1)*0.E-323),0,( ...
0.E-323+sqrt(-1)*0.132584E5).*e.^(sqrt(-1).*t.*((-1).*o+p+(-1).*q+ ...
w)),(sqrt(-1)*(-1)).*(q+(-1).*w),(0.E-323+sqrt(-1)*0.E-323);0,0,( ...
0.E-323+sqrt(-1)*0.E-323),0,0,(0.E-323+sqrt(-1)*0.E-323),(0.E-323+ ...
sqrt(-1)*0.E-323),(0.E-323+sqrt(-1)*0.E-323),0];
It is unclear which element you mean by "second", so lets have at look at both of these:
format long G
M(1,2) % not zero
M(2,1) % not zero
Most likely you are making the mistake of confusing how data are displayed with what data are stored in memory.
Alland Kiepert
2022년 3월 10일
James Tursa
2022년 3월 10일
Yes
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!