I have got the following output of the two columns of a matrix:
final_matrix2 =
0.0054 0.0000
0.0051 0.0000
0.0047 0.0000
0.0042 0.0000
0.0056 0.0000
0.0034 0.0000
0.0059 0.0000
The second column consists of zeros as it is of the order 1e-9 or 1e-10 or even lower.
I assume that these zeros appear due to the difference in magnitude (order) between the elements in two columns.
Is there a way to show correctly the elements in both columns within the same matrix?
First I simulate your problem . .
>> finalMatrix = randn(5,2)
finalMatrix =
-1.3499 -0.2050
3.0349 -0.1241
0.7254 1.4897
-0.0631 1.4090
0.7147 1.4172
>> finalMatrix(:,2) = finalMatrix(:,2)*1e-20
finalMatrix =
-1.3499 -0.0000
3.0349 -0.0000
0.7254 0.0000
-0.0631 0.0000
0.7147 0.0000
Then use the format
command to show the missing precision (longG
format works best for your specific issue) . .
>> format longG
>> finalMatrix
finalMatrix =
-1.34988694015652 -2.04966058299775e-21
3.03492346633185 -1.24144348216312e-21
0.725404224946106 1.48969760778546e-20
-0.0630548731896562 1.40903448980048e-20
0.714742903826096 1.41719241342961e-20
>>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With