Apparently unpredictable errors on evenly spaced breakpoints for Prelookup Block

2 次查看(过去 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.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by