
Feeding parameters into the State-Space block in Simulink through variables.
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello,
I'm trying to implement a solutions to a Linear System but I want to input its parameters automatically into the block using the Simulink canvas. So far, I used the canvas on one part to calculate the A, B, C, and D matrices, using the matlab functions block, and then, with the help of a "To Workspace" for each matrix, sent them to the Workspace. Like so:

My plan was that, given that I was sending each matrix to the workspace, I could just call them in the parameters box for the State Space Block. Like so:

Alas, it does not work. When I run the simulation, the message I get is the following:
"Invalid setting in 'twod/State-Space' for parameter 'A'. Caused by: Error evaluating parameter 'A' in 'twod/State-Space' Undefined function or variable 'A'."
Is there a way I could do this? An automatic feed of the parameters for the State Space Block?
Thank you,
댓글 수: 0
답변 (1개)
Gayathri
2025년 2월 12일
편집: Gayathri
2025년 2월 12일
We can use the "Parameter Writer" block to update the parameters of another block. Please look into the screenshot below on how to modify the "Block Parameters" of the "Parameter Writer" block.

Here I am using a simple model to illustrate the usage. I am giving a sine wave as input to the "Parameter Writer" block which changes in real time. And this value would be used in real time for parameter "A" in "State Space" block.
For your purpose, you can add four "Parameter Writer" blocks to capture values of "A", "B", "C" and "D". You can also use this block to write values to the base workspace simultaneously.
For more information on "Parameter Writer", please refer to the below documentation link.
Hope you find this information helpful!
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Event Functions에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!