Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Rohit
Posts:
2
Registered:
8/23/13


Concatenating matrix columns causes loss of precision
Posted:
Aug 23, 2013 1:41 AM


Hi all, I have a curious problem I'm hoping someone can help me with. I have a column matrix say temp1 with floating point numbers in the following format(displayed this way using format long g):
1334320224.86767 1334320225.03415 1334320225.20064
and another nx3 matrix (temp2) with values like so:
25.59989 17.82167 31.19241 25.17558 17.59459 30.71448 25.18788 17.39987 30.61347
I concatenate the 2 matrices column wise, temp = [temp1 temp2]; The resulting matrix is:
1.334305e+09 24.40084 17.98591 30.31327 1.334305e+09 24.23554 17.68831 30.00396 1.334305e+09 25.31328 17.61529 30.83927 I want the resulting matrix to have the original precision of temp1. How do I do this? I have already tried format long g. Writing to a file with dlmwrite and precision set to %.5f results in the fractional part zeroed out.



