How can I change precision in Matlab?

2 visualizzazioni (ultimi 30 giorni)
Kyriacos Patsalides
Kyriacos Patsalides il 26 Apr 2017
Commentato: Stephen23 il 26 Apr 2017
I am comparing some values between Fortran 90 and Matlab. The calculated value of A in Fortran has 20 digits, thus when calculating B it also has 20 digits. The same calculations are made in Matlab but the calculated value of A has 15 digits, thus the calculation of B will be different from the B calculated in Fortran.
How can I make Matlab calculating everything with a precision of 20 digits such as Fortran does?

Risposte (1)

KL
KL il 26 Apr 2017
try vpa
vpa(B,20)
  2 Commenti
Kyriacos Patsalides
Kyriacos Patsalides il 26 Apr 2017
I tried that one but then Matlab gives my an error. I know that Matlab can provide up to 16 digits but I don't know if i must have like a specific version of Matlab that will allow me to use vpa
Stephen23
Stephen23 il 26 Apr 2017
@Kyriacos Patsalides: vpa does not require a special version of MATLAB, but it is a part of the symbolic toolbox. If you do not have that toolbox installed and have a license for it then you will not be able to use it.

Accedi per commentare.

Categorie

Scopri di più su Fortran with MATLAB in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by