How can I implement "interp2" in Simulink without using a MATLAB Function block?
조회 수: 5 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2016년 10월 28일
답변: MathWorks Support Team
2016년 10월 31일
How can I implement "interp2" in Simulink without using a MATLAB Function block?
채택된 답변
MathWorks Support Team
2016년 10월 28일
A functionality that is identical to "interp2" can be implemented in Simulink using a 2-D Lookup Table.
For instance, let us assume that we would like to interpolate in the "peaks" function as evaluated over an X-Y grid where both X and Y vary from -3 to 3 with increments of 1.
In this case, the breakpoints for the lookup table should be entered as
[-3:3]
Notice that the breakpoints are supplied as regular 1-D arrays. The table data, however, should be the function "peaks" evaluated over a 7-by-7 grid, as shown below.
[X,Y] = meshgrid(-3:3);
V = peaks(X,Y);
The variable "V" can then be supplied as table data in the 2-D Lookup Table dialog box.
Now the lookup table inputs u1 and u2 will correspond to the query points Yq and Xq, respectively.
The block will return a scalar output in response to scalar inputs.
If the inputs are 2-D grid coordinates, as constructed by the "meshgrid" function, the block will output a matrix.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Nonlinearity에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!