Coefficients from butter function differ between platforms

조회 수: 3 (최근 30일)
Bjarke Skogstad Larsen
Bjarke Skogstad Larsen 2017년 2월 17일
댓글: Walter Roberson 2017년 2월 23일
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에서 Filter Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by