2-D, 3-D, n-D data interpolation - Is it possible to extrapolate?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello,
I'm having the following situation, I have a 2-D Look-up Table in Simulink using the below data.
row_index = [5 25 35]
col_index = [-20 -3 0 5 40]
table_data =
3.0000 1.0000 0 1.5000 2.0000
3.0000 1.0000 0 1.5000 2.0000
3.0000 1.0000 0 1.5000 2.0000
What I'm trying to do is to have the same result (as the 2-D Look-up Table output from Simulink) using Matlab code/functions. I've tried using interp2, but if the values are extrapolated/out of rage, I get a NaN. I'm using version 7.13 (Matlab 2011) and I don't know if is there a solution for this.
For example interp2(col_index,row_index,table_data,-20,5) returns 3 witch is correct.
But if I use interp2(col_index,row_index,table_data,5,-20) returns NaN witch is also correct according to the function description, but in Simulink the 2-D Look-up Table returns 1.5
I'm asking you if is there a solution to get the same result as the 2-D look-up table from simulink. And the same for 3-D or n-D.
Thanks,
Alex
댓글 수: 0
답변 (1개)
Sean de Wolski
2012년 10월 31일
You can set the 'ExtrapVal' to be non-nan:
Of course this is dangerous:
You may also like one fo the FEX extrapolation tools.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Approximate Functions with Lookup Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!