Apparently unpredictable errors on evenly spaced breakpoints for Prelookup Block
Show older comments
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
Accepted Answer
More Answers (1)
Mahesh Pai
on 26 Oct 2016
0 votes
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 Comments
Tobias Gemaßmer
on 27 Oct 2016
Mahesh Pai
on 27 Oct 2016
Thank you for you response. I used the above break point data and I was able to simulate a example model successfully.
Can you attach your example model that is causing issues in a comment below so that I am can reproduce this on my system? Please let me know the version of MATLAB you are using as well.
Tobias Gemaßmer
on 7 Nov 2016
Edited: Andreas Goser
on 16 Dec 2016
Tobias Gemaßmer
on 15 Dec 2016
Andreas Goser
on 16 Dec 2016
FYI, I am XXXX ing out the license number
Andreas Goser
on 16 Dec 2016
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.
Categories
Find more on Variables 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!