how to increase the decimal place and it must be side to side as below

1 view (last 30 days)
The matrix is not strictly diagonally dominant at row 1(ignore this)
approximated, exact=
0.18221-0.73861i 0.18233-0.73524i
0.0032185-0.22997i 0.0022028-0.22863i
========================================
answer of my code is below it must be like the above answer
approximated=
0.1822 - 0.7386i
0.0032 - 0.2300i
exact=
0.1823 - 0.7352i
0.0022 - 0.2286i
=============================================

Answers (1)

dpb
dpb on 29 Mar 2021
fmt=['%0.4f%+0.4fi\t%0.4f%+0.4fi\n'];
>> for i=1:size(approx,2)
fprintf(fmt,real(approx(i)),imag(approx(i)),real(exact(i)),imag(exact(i)))
end
0.1822-0.7386i 0.1823-0.7352i
0.0032-0.2300i 0.0022-0.2286i
>>
Will leave adding header line as exercise...

Categories

Find more on Operating on Diagonal Matrices in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!