Converting fortran code to matlab

1 Ansicht (letzte 30 Tage)
Gerd
Gerd am 19 Apr. 2011
Hello,
I have a Fortran .dll compiled on a Win32 XP machine and the fortran source code. I moved the code to Matlab to be more flexible on new code development. Comparing the results of the .dll and the Matlab code I receive a relative accuracy error between 0.01% and 3%. My question is:
  • both programms use double resp. real*8 numbers
  • both programms are running on the same computer.
Why do I get these errors in accuracy?
Gerd

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 19 Apr. 2011
Fortran and MATLAB may use different default rounding schemes.
When you converted the code to MATLAB, did you ensure that all of the operations would be done in exactly the same order as in Fortran? MATLAB's order of operations may be different than Fortran even for identical code lines.

Weitere Antworten (1)

Gerd
Gerd am 9 Mai 2011
Hi Walter,
thank's for your reply. I did a lot of investigations on my code. The code "looks" like the same as in my fortran code. Anyway the code reproduces now some minor roundness error what I can tolerate. Again thank you Gerd

Kategorien

Mehr zu Fortran with MATLAB finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by