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

1 次查看(过去 30 天)
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
=============================================

回答(1 个)

dpb
dpb 2021-3-29
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...

类别

Help CenterFile Exchange 中查找有关 Operating on Diagonal Matrices 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by