round() function does not work as expected
Ältere Kommentare anzeigen
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?
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!