As far as MATLAB is concerned, it has finished the calculations. It has given you exact analytic solutions, rather than mere 16 digit floating point approximations.
I notice that your outputs are complex valued. You need to take extra steps to output complex values properly.
dd = double(d);
fprintf(fid,'%+5.5f %+5.5fi\n', [real(dd(:)), imag(dd(:))].' );
Here the "i" after the "%+5.5f" is just a literal character to indicate the imaginary component.
In the example above it appears that the imaginary component vanishes in practice, which is not at all obvious from casual examination. If that is the situation for all values, then you could use
fprintf(fid,'%+5.5f\n', real(dd(:)) );
but unless you can prove that the imaginaries will vanish, outputting them would be safer.
Best Answer