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.
Apparently unpredictable errors on evenly spaced breakpoints for Prelookup Block
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Tobias Gemaßmer
il 20 Ott 2016
Modificato: Tobias Gemaßmer
il 4 Gen 2017
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:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/157291/image.png)
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
0 Commenti
Risposta accettata
Più risposte (1)
Mahesh Pai
il 26 Ott 2016
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 Commenti
Andreas Goser
il 16 Dic 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.
Vedere anche
Categorie
Scopri di più su Simulink Functions in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!