
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!