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

조회 수: 1 (최근 30일)
Ali Al raeesi
Ali Al raeesi 2021년 3월 29일
답변: dpb 2021년 3월 29일
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