필터 지우기
필터 지우기

Apparently unpredictable errors on evenly spaced breakpoints for Prelookup Block

조회 수: 6 (최근 30일)
Dear all,
I am having Trouble with the Prelookup Block using the Index search method "Evenly spaced Points".
Even when using the example code from http://de.mathworks.com/help/simulink/ug/characteristics-of-lookup-table-data.html#br3_ved I often receive an error that my breakpoint data is not evenly spaced to the last bit.
This error seems to come only if the breakpoint data has both negative and positive data, and even then not always. I have created a minimal working example to further investigate this:
Depending on the Manual Switches the error Comes up or not. Is this a known issue, or does anyone have any idea how to fix this?
I am using Simulink 8.4.
Thank you for your help!
Tobias

채택된 답변

Tobias Gemaßmer
Tobias Gemaßmer 2017년 1월 4일
편집: Tobias Gemaßmer 2017년 1월 4일
Hi everyone, I solved that issue by writing a short script that manipulates the breakpoint vector in a way to assure evenly spaced breakpoints down to the last bit of precision. However, could this functionality not be part of the prelook up block? Maybe at least as an optional setting? I think slight manipulation of some breakpoint data in the 15th decimal place will not modify simulation results or lookup table output in most cases.

추가 답변 (1개)

Mahesh Pai
Mahesh Pai 2016년 10월 26일
It is my understanding that you would like to know why you are receiving an error that your data is not evenly spaced to the last bit even when you are providing data that is evenly spaced to the "Prelookup" block.
This is a numerical issue intrinsic to floating-point data types, not with the block or the MATLAB expression. The workaround is to scale the data value to be more precisely representable by the floating-point data types, for example, an integer even spacing, [1:1:500].
In the example you have provided above, you can observe this numerical issue in "Display1" and "Display3" in the 1st and 4th field respectively. In order to fix this issue, please change the value of "Constant4" and "Constant5" to
[-0.9:1:1.1]/10
and
[-5:1:5]/5
respectively.
Since the spacing above is of an integer data type, it avoids numerical issues intrinsic to floating-point data types.
  댓글 수: 6
Andreas Goser
Andreas Goser 2016년 12월 16일
Hallo Herr Gemaßmer. Falls Sie hier in der Communinty nicht die Antworten in der von Ihnen benötigten Geschwindigkeit bekommen, bitte ich Sie den Technischen Support zu kontaktieren - gerne auch mit Verweise auf diesen Post. einfach hier oben auf Contact Us und die Kontaktinformationen für Deutschland klicken.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by