필터 지우기
필터 지우기

Method to get real time value from Lookup table in Simulink

조회 수: 3 (최근 30일)
Dongsuk Kim
Dongsuk Kim 2022년 12월 14일
답변: Ashutosh Bajpai 2023년 2월 17일
Hello, I want to make an model using matlab function block in Simulink which reflects real time value from Lookup table as the result of the matlab function block changes. The result of matlab function block is the input of the Lookup table. Would there be a method to realize that? Thanks!

답변 (1개)

Ashutosh Bajpai
Ashutosh Bajpai 2023년 2월 17일
You can use a MATLAB Function block in Simulink to reflect the real-time value from a lookup table as the result of the block changes. To do this, you can use the interp1 function in MATLAB to perform the lookup operation and return the result as the output of the function block. You can then use this output as the input to the lookup table. An example of this implementation would look like the following code:
function y = myFunction(u)
table = [0 1; 2 3; 4 5]; % Define your lookup table
y = interp1(table(:,1), table(:,2), u); % Perform the lookup
end
In this code, "u" is the input to the function block and "y" is the output, which is passed to the lookup table. You can then use this code in a MATLAB Function block in Simulink, and connect the input and output ports as needed.

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by