Filter löschen
Filter löschen

How to determine fraction as an output?

1 Ansicht (letzte 30 Tage)
Mohammad Ezzad Hamdan
Mohammad Ezzad Hamdan am 19 Mai 2018
Kommentiert: Walter Roberson am 19 Mai 2018
I used the '[v,d]=eig(A)' function, but it prints 72.00000 instead of 72. If it is a fraction (eg: 1/3 which will produce 0.3333), then its fine. Are there any specific function to avoid this?

Antworten (1)

Walter Roberson
Walter Roberson am 19 Mai 2018
There is probably some round-off error so that the 72.00000 that you are seeing is not exactly 72 . You can subtract 72 from the output to see how large the difference is.
  2 Kommentare
Mohammad Ezzad Hamdan
Mohammad Ezzad Hamdan am 19 Mai 2018
i have calculated and the answer should be 72 only, not 72.000001 for instance.
Walter Roberson
Walter Roberson am 19 Mai 2018
Eigenvalue computation involve finding the roots of polynomials. For 3x3 matrices, floating point roundoff difficulties is typical, and for 4x4 matrices, floating point roundoff is almost certain, and for larger matrices the only way to avoid it would be to use a detailed knowledge of the computation and of floating point representation to work backwards to create one of the rare matrices that did not have floating point roundoff problems.
If you need exact values then you need to switch to the Symbolic Toolbox, which can give you exact values up to 4x4 matrices. Just be prepared for typical eigenvalues to be expressions at least 4000 characters long.

Melden Sie sich an, um zu kommentieren.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by