round() function does not work as expected
이전 댓글 표시
I have the following array as the output of my function: [16.9900000000000 + 0.00000000000000i 9.49188888257731 + 1.38777878078145e-16i 1.55759614170397 - 1.11022302462516e-16i 3.03346810679636 - 2.77555756156289e-16i 8.03389530551741 + 4.16333634234434e-17i], whereas the correct output is [17 9.50000000000000 1.60000000000000 3 8]. I expected by using X = round(real(X), 1); I could get the outputs to match, but instead it gives [16.9000000000000 7.90000000000000 2.90000000000000 5.40000000000000 8.10000000000000]. What causes this? How can I fix this?
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!