Why do I get different results for gauss fit performed on different computer?
3 views (last 30 days)
Show older comments
I am performing gaussian fits with fit()-method and observed different results (coefficients) depending on the PC I am using. I first encountered this issue when finished my code in Matlab (R2022b), compiled an .exe-file and ran that file on another pc with the runtime compiler (9.13). Let me list what I have tried since to analyze this behavior:
- Same code with same input data run in Matlab R2022b and with runtime compiler on another PC yield different gauss-fit results (4, 5, 6, 7 and 8 terms all tested).
- Checked input data, they are indeed the same in both instances up to 1e-64 decimal points.
- Defined fixed values (all 0) for starting points as fitoption. Results between two versions are the same, but fit-quality is misrable.
- Installed Matlab (2023b) on computer where I ran the .exe-file, ran same code with same data and got exaclty same results as with .exe, which means different than on the other computer with Matlab 2022b.
- Extracted one set of data and used "curve fitter"-app to perform gauss-fit on both computers, all fit options equal. Resulting coefficients (and SSE) are different, but coefficient constraints, namely StartPoints, are the same.
At one point, I thought the starting points are calculated differently between the two computers, but the results from he curve fitter app give me pause. Can somebody provide clarity in this case?
0 Comments
Accepted Answer
Drew
on 15 Nov 2023
What is the magnitude of the differences you are observing in the resulting coefficients and SSE? Gaussian curve fitting uses the NonlinearLeastSquares method which involves iterative floating point computations. Any change, however small, in the underlying mathematical libraries could lead to differences in the computed fit. Within the range of the stability/usefulness/suitableness of this gaussian functional form to fit your data, the high-level expectation is that the resulting fit from both computers should be similarly acceptable and useful for the intended purpose. In other words, the differences between the fits are expected to be relatively small.
If this answer helps you, please remember to accept the answer.
More Answers (0)
See Also
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!