Array variable as parameter value in simulink

조회 수: 1 (최근 30일)
Sridhar Balasubramanian
Sridhar Balasubramanian 2022년 1월 16일
댓글: Sridhar Balasubramanian 2022년 1월 16일
Hi,
I have an 1-D array (ex: A) with a size exactly matching that of the total simulation steps. This array can be either stored in model or base workspace.
I need to set a block parameter to A(Index) with its index changing according to the simulation time.
How can I do this?
Thank you for your help.

채택된 답변

Paul
Paul 2022년 1월 16일
Use a Selector block. Choose the 'Index option' as 'Index vector - port'. Then connect A to the U port and feed the Indx1 port with an integer that you develop from the the simulation time.
  댓글 수: 3
Paul
Paul 2022년 1월 16일
If implemented properly, the output of the selector block is A(index). Multiply it with the output of a Clock and then input the product into a Trigonometric Function block.
Another way to get A(index) is to use the 1-D Lookup Table block. Specify 'Flat' as the interpolation method. This approach would probably be easier than using the Selector block.
Sridhar Balasubramanian
Sridhar Balasubramanian 2022년 1월 16일
Thank you.. I used set_param to update A(Index) in my block.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Physical Units에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by