Apparently unpredictable errors on evenly spaced breakpoints for Prelookup Block

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

 Respuesta aceptada

Tobias Gemaßmer
Tobias Gemaßmer el 4 de En. de 2017
Editada: Tobias Gemaßmer el 4 de En. de 2017
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.

Más respuestas (1)

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 comentarios

Thank you for your answer. However, some issues are not yet clear to me. The provided example actually worked with Constant4 as showed, but did not work with Constant1. Your suggestions also worked, but for example if I use something like
[-7:2:13]/10
this also throws an error. Is that spacing not of integer data type?
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
Tobias Gemaßmer el 7 de Nov. de 2016
Editada: Andreas Goser el 16 de Dic. de 2016
Attached you can find my exmple model.
I am using:
MATLAB Version: 8.4.0.150421 (R2014b)
MATLAB License Number: ****
Operating System: Microsoft Windows 7 Professional Version 6.1 (Build 7601: Service Pack 1)
Java Version: Java 1.7.0_11-b21 with Oracle Corporation Java
HotSpot™ 64-Bit Server VM mixed mode
----------------------------------------------------------------------------------------------------
MATLAB Version 8.4 (R2014b)
Simulink Version 8.4 (R2014b) ...
Hello, are there any updates on my issue yet?
Regards Tobias
FYI, I am XXXX ing out the license number
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.

Iniciar sesión para comentar.

Categorías

Más información sobre Variables en Centro de ayuda y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by