
Feeding parameters into the State-Space block in Simulink through variables.
2 views (last 30 days)
Show older comments
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 Comments
Answers (1)
Gayathri
on 12 Feb 2025
Edited: Gayathri
on 12 Feb 2025
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 Comments
See Also
Categories
Find more on Event Functions in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!