フィルターのクリア

How to use set_param -function with step block in simulink?

18 ビュー (過去 30 日間)
Ion
Ion 2013 年 12 月 11 日
編集済み: Arun Kumar Kantheti 2022 年 5 月 6 日
Hello,
I´ve been using set_param -function with my simulations during the last days. However, now I can´t somehow use it with my step-function in order to set a new "final value" for the step-block between several simulations. Below you can see how I´ve defined the settings for the step-function:
As you can see, the Step-function is named as "Ref" and the parameter, that I would like to change between several simulations is named "reference".
Below you can see the top view of my simulink model:
In my matlab script I try to change the "reference" value inside the step-function as follows:
When the software comes to the "set_param" point, I get this error message:
Step block does not have a parameter named 'reference'
The set_param -function has worked several times for me, but now there´s a problem with step-function. What is wrong in my simulations?
Thank you for any kind of help!
  1 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 12 月 11 日
Instead of posting an image, please post your code.

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

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 12 月 11 日
編集済み: Azzi Abdelmalek 2013 年 12 月 11 日
Why do you think Reference is a parameter in a step bock. Like you see the parameters are
  1. Step time
  2. Initial value
  3. Final value
  4. Sample time
  5. ...
Even with those parameters you can't use set_param, to get the appropriate names of those parameters you can use
get_param('filename/Ref','dialogparameters')
ans =
Time: [1x1 struct]
Before: [1x1 struct]
After: [1x1 struct]
SampleTime: [1x1 struct]
VectorParams1D: [1x1 struct]
ZeroCross: [1x1 struct]
For your case
set_param('filname/Ref','after', num2str(step_value))
  1 件のコメント
Walter Roberson
Walter Roberson 2018 年 11 月 9 日
Zimam Amer Muhamad commented:
to check the parameter of block

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

その他の回答 (1 件)

Nam nguyen
Nam nguyen 2019 年 3 月 5 日
how to set_param final clock block simulink?
  1 件のコメント
Arun Kumar Kantheti
Arun Kumar Kantheti 2022 年 5 月 6 日
編集済み: Arun Kumar Kantheti 2022 年 5 月 6 日
If you are looking to set stop time then you may use:
tfin = 10;
model = 'model1';
open_system(model);
set_param(model,'StopTime', num2str(tfin));
Moreover, if you ever want to know the parameters associated with any block you may use:
get_param([model '/Gain1'],'dialogparameters')
The above line would provide all the parameters of the gain block named 'Gain1' in the simulink model named 'model'

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

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by