将 MATLAB 中的状态 space 值写入 simulink 中的状态 space 块

Write state space values from MATLAB to the state space block in simulink

如何将在 MATLAB 中生成的 A、B、C 和 D 矩阵写入 Simulink 中的 state-space 块?我有一个 ss class 变量,我可以从中提取这些矩阵。也许有某种辅助函数接受 ss 变量并自动将矩阵写入块?

我问的原因是因为如果有大量状态,在字段中手动编写这些矩阵可能会非常麻烦。

如果您使用的是 Simulink 的 State-Space 块并且您的 A、B、C、D 矩阵是全局工作中的变量space,您应该能够将它们输入state space 块并让它在矩阵值更改时自动更新。

... [U]se your workspace commands to create four matrices A,B,C,D. Then go into your Simulink model, and double-click to open your State-Space block, then under the field of parameter A, just type A again, then under B, type B again, and so on.

Source