Simscape issue using "tablelookup"

2 visualizaciones (últimos 30 días)
Steve Tweddell
Steve Tweddell el 4 de Jul. de 2015
Respondida: Darsana Thulasi el 6 de Jul. de 2015
Hi,
I am building a custom component that makes a call to "tablelookup" with the target values defined as "parameters", the code compiles without error my issue is that the resulting interpolation is wrong. The result appears to be saturated by the selected extrapolation method "nearest" even when the defined inputs are within the defined interpolation matrix. I have tried an alternative method with used "inputs" rather than "parameters" to declare the target inputs and this appears to work fine. I have provided a simplified sample code which replicates my issue. If anyone can see an issue with my approach, guidance would be much appreciated.
component interp_test % Table lookup test
parameters
u1 = {0, 'deg'};
u2 = {0, '1'};
end
outputs
y = {0, '1'};
end
parameters (Access = private)
xd = {[10:10:180], 'deg'};
yd = {[0.5:0.5:10], '1'};
zd = {[ 1.030454533 1.02020134 1.02020134 1.030454533 1.030454533 1.030454533 1.030454533 1.040810773 1.040810773 1.040810773 1.040810773 1.040810773 1.051271097 1.051271097 1.051271097 1.051271097 1.051271097 1.051271097 1.051271097 1.051271097
1.051271097 1.030454533 1.040810773 1.040810773 1.051271097 1.051271097 1.051271097 1.051271097 1.051271097 1.061836545 1.061836545 1.061836545 1.061836545 1.061836545 1.061836545 1.061836545 1.083287066 1.083287066 1.083287066 1.083287066
1.127496849 1.061836545 1.061836545 1.061836545 1.061836545 1.061836545 1.051271097 1.051271097 1.10517092 1.061836545 1.10517092 1.061836545 1.061836545 1.061836545 1.10517092 1.10517092 1.10517092 1.10517092 1.10517092 1.10517092
1.221402762 1.083287066 1.083287066 1.083287066 1.083287066 1.083287066 1.10517092 1.10517092 1.10517092 1.10517092 1.10517092 1.127496849 1.127496849 1.127496849 1.127496849 1.127496849 1.127496849 1.127496849 1.127496849 1.1502738
1.349858824 1.127496849 1.10517092 1.10517092 1.10517092 1.10517092 1.10517092 1.10517092 1.127496849 1.127496849 1.127496849 1.127496849 1.127496849 1.1502738 1.1502738 1.1502738 1.1502738 1.1502738 1.1502738 1.173510867
1.491824707 1.173510867 1.127496849 1.127496849 1.127496849 1.127496849 1.127496849 1.127496849 1.127496849 1.1502738 1.1502738 1.1502738 1.173510867 1.1502738 1.173510867 1.173510867 1.173510867 1.173510867 1.197217372 1.197217372
1.822118844 1.221402762 1.1502738 1.127496849 1.127496849 1.127496849 1.127496849 1.1502738 1.1502738 1.1502738 1.173510867 1.173510867 1.173510867 1.197217372 1.197217372 1.197217372 1.197217372 1.197217372 1.221402762 1.221402762
2.225540955 1.246076729 1.173510867 1.1502738 1.1502738 1.1502738 1.1502738 1.1502738 1.173510867 1.173510867 1.197217372 1.197217372 1.197217372 1.197217372 1.221402762 1.221402762 1.221402762 1.221402762 1.246076729 1.246076729
2.718281828 1.271249144 1.197217372 1.173510867 1.173510867 1.173510867 1.173510867 1.173510867 1.197217372 1.197217372 1.197217372 1.221402762 1.221402762 1.221402762 1.246076729 1.246076729 1.246076729 1.246076729 1.271249144 1.271249144
2.718281828 1.271249144 1.221402762 1.197217372 1.173510867 1.173510867 1.197217372 1.197217372 1.221402762 1.221402762 1.221402762 1.246076729 1.246076729 1.246076729 1.246076729 1.271249144 1.271249144 1.271249144 1.271249144 1.296930074
2.718281828 1.271249144 1.221402762 1.197217372 1.197217372 1.197217372 1.197217372 1.221402762 1.221402762 1.246076729 1.246076729 1.246076729 1.271249144 1.271249144 1.271249144 1.296930074 1.296930074 1.296930074 1.296930074 1.296930074
2.718281828 1.271249144 1.221402762 1.197217372 1.197217372 1.197217372 1.221402762 1.246076729 1.246076729 1.246076729 1.271249144 1.271249144 1.271249144 1.296930074 1.296930074 1.296930074 1.323129814 1.323129814 1.323129814 1.323129814
2.718281828 1.271249144 1.246076729 1.197217372 1.197217372 1.221402762 1.246076729 1.246076729 1.271249144 1.271249144 1.296930074 1.296930074 1.296930074 1.323129814 1.323129814 1.323129814 1.349858824 1.349858824 1.349858824 1.349858824
2.718281828 1.349858824 1.246076729 1.197217372 1.197217372 1.221402762 1.246076729 1.271249144 1.271249144 1.296930074 1.296930074 1.323129814 1.323129814 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824
2.718281828 1.349858824 1.246076729 1.221402762 1.221402762 1.221402762 1.246076729 1.271249144 1.296930074 1.296930074 1.323129814 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824
2.225540955 1.349858824 1.246076729 1.221402762 1.221402762 1.246076729 1.246076729 1.271249144 1.296930074 1.323129814 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824
2.718281828 1.349858824 1.246076729 1.221402762 1.221402762 1.246076729 1.271249144 1.296930074 1.323129814 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824
2.718281828 1.349858824 1.246076729 1.221402762 1.221402762 1.246076729 1.271249144 1.296930074 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824 1.349858824], '1'};
end
equations
y == tablelookup(xd, yd, zd, u1, u2, interpolation=spline, extrapolation=nearest);
end
end

Respuestas (1)

Darsana Thulasi
Darsana Thulasi el 6 de Jul. de 2015
The documentation for 'tablelookup' indicates that for the parameter 'extrapolation', the output value is chosen based on the input value being outside the range. You may have to choose 'interpolation' instead.

Categorías

Más información sobre Foundation and Custom Domains en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by