Stop Matlab ignoring numbers
Afficher commentaires plus anciens
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 commentaires
KSSV
le 10 Mar 2022
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
le 10 Mar 2022
James Tursa
le 10 Mar 2022
Yes
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Get Started with MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!