I am trying to implement a state space solution in Simulink with 1 variable m in matrix C, but the runtime error says Variable ‘m’ does not exist.

2 ビュー (過去 30 日間)
xin
xin 2024 年 9 月 15 日
回答済み: Paul 2024 年 9 月 15 日
I am trying to implement a state space solution in Simulink with 1 variable m in matrix C, but the runtime error says Variable ‘m’ does not exist.
How to assign a value to the variable m?
The callback strings are A=[0 1;-2 -3]; B=[0 1]'; C=[1 0;0 m]; D=[0 ;0];'
Here's the model I uploaded.

回答 (1 件)

Paul
Paul 2024 年 9 月 15 日
The Goto block is used for signal flow, not assignment to a variable. The Constant1 and Goto blocks can be deleted.
The easiest path forward is to define a value for m in the base workspace, either at the command line, or in a script, or in the model initialization code itself.
Is there a reason to use the model initialization code? Typically one would enter the expressions for the A,B,C, and D matrices as dialog parameters in the State Space block. If you do that, other options would be to define m in the Model workspace, or in a Simulink.SimulationInput object if using the sim command.

カテゴリ

Help Center および File ExchangeModeling についてさらに検索

製品


リリース

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by