Coefficients from butter function differ between platforms

2 次查看(过去 30 天)
I've into something I find odd.
When comparing results with a colleague, we discovered some differences even though we ran the same code and had the same Matlab version (9.0.0.341360 (R2016a)). In the end, we tracked down the culprit to be the coefficients calculated by Matlab's built-in function: butter.
[b,a]=butter(4,[15/(8000/2),100/(8000/2)])
On Windows we get:
b =
1.0e-05 *
0.1140 0 -0.4560 0 0.6841 0 -0.4560 0 0.1140
On Linux we get
b =
1.0e-05 *
0.1139 0 -0.4558 0 0.6836 0 -0.4558 0 0.1139
I haven't tested to see if these differences extend to other filter functions but I was surprised to see this difference. Is this normal behaviour? Can anybody offer an explanation? :-)
I have some toolboxes on Windows which aren't present on Linux. I doubt this is the reason though?
----- I found someone having a similar problem, though this was due to different versions of Signal Processing Toolbox. I've since check that we have the same version of the Signal Processing Toolbox on Linux and Windows: Signal Processing Toolbox Version 7.2 (R2016a)
Link so solution: https://se.mathworks.com/matlabcentral/answers/98640-why-does-the-butter-function-return-different-results-for-signal-processing-toolbox-4-3-and-5-0?s_tid=srchtitle
-----
I still find this behaviour strange, when both systems have the same version of the toolbox.

采纳的回答

Shashank
Shashank 2017-2-23
Hi Bjarke,
There may be many factors causing this mismatch. For example, 'butter' function you mentioned might use some library under the hood for computation, say LAPACK. Different versions of this library might lead to minor differences in the output.
In your case as I observe the difference is minimal.
You can read more about why this may occur here:
Regards,
Shashank
  1 个评论
Walter Roberson
Walter Roberson 2017-2-23
Correct. This is known behaviour. In that release, the high performance library versions used were different between Windows compared to OS-X or Linux (and that is not even taking into account that compiling those high speed libraries on different platforms can end up generating different code with different round-offs due to compiler differences.)
Some of the consequences of this difference in versions can be much more visible, such constraints being declared as violated on one platform but not on another. Eigenvalues are affected, and covariance matrices can come out determined to be not Positive Definite.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Audio I/O and Waveform Generation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by