Recompiling an S function, altered results

2 次查看(过去 30 天)
Hello,
I'm trying to restore an old Simulink S-function. The function was last compiled ~2004, and I am trying to recompile it now. I've successfully compiled the C-code using both MS Visual C++ 2008 Express and GCC (via MinGW), and was unsuccessful compiling the code using LCC or Open WATCOM. MATLAB version R2009a.
Currently, when the code is run and compared against the results from the "Old" (2004) mex functions, the results differ. It appears as if a very small initial error propagates. I am using the same conditions for the tests, same version of MATLAB, but I still get small, but distinctively different, changes in the results. From the 2 compilers which I have been successful compiling (GCC and MS Visual C++), I get identical results. I think the code may have been originally compiled with the Intel compiler, which is not available to me. Since the other compilers which I used have identical results, I don't think this is the issue. Also, I have tested in R2009a and R2007b.
Any ideas what could be causing the differences in results? Same source code, same initial conditions, different simulation results.
Thanks a lot for any ideas, I know this isn't a ton to go on.
JR
  3 个评论
Kaustubha Govind
Kaustubha Govind 2011-8-9
Is there a 32-bit vs. 64-bit difference in the platforms?
John Robinson
John Robinson 2011-8-9
No, everything thus far has been 32-bit. Thanks for the idea though.

请先登录,再进行评论。

采纳的回答

MarkB
MarkB 2011-8-15
I recommend checking to see if there are any differences in support for floating-point operations. Specifically, check to see if things like math.h have support for both "float" and "double", or just "double" (this difference comes up with ANSI vs ISO implementations of C).

更多回答(0 个)

产品

Community Treasure Hunt

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

Start Hunting!

Translated by