I want to change a variable in SIMULINK using m-file.Suppose for a certain simulation time t=0 to 5,I want V=10 and for t=5 to 10, V=20. How to write in m-file

回答 (1 件)

Sebastian Castro
Sebastian Castro 2015 年 10 月 20 日
編集済み: Sebastian Castro 2015 年 10 月 20 日
It might be doable with callbacks and such, but I'd recommend going simple if possible.
The easiest thing would be converting that V parameter into an input and passing the following time data in with an Input port or a From Workspace block (your choice).
>> t = [0;5;5;10];
>> V = [10;10;20;20];
- Sebastian

2 件のコメント

SIDHARTH SABYASACHI
SIDHARTH SABYASACHI 2015 年 10 月 21 日
編集済み: SIDHARTH SABYASACHI 2015 年 10 月 21 日
Thank you for your reply Sir.I have tried this but while running,it is showing the error that Parameter 'Amplitude' must be a scalar value. Please help me to resolve this.I want to change the variable in the simulink model parameter.
Yes, my suggestion was to change it from a parameter to be an input signal. To do this, pass V in using an Input port, From Workspace block, or equivalent.

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeSimulink についてさらに検索

質問済み:

2015 年 10 月 20 日

コメント済み:

2015 年 10 月 21 日

Community Treasure Hunt

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

Start Hunting!

Translated by