How to display a tf function in the command window frm simulink??

235 ビュー (過去 30 日間)
Nitesh
Nitesh 2015 年 9 月 19 日
コメント済み: @Johannes 2015 年 9 月 25 日
I have a tf of a plant which i need the be pulled from the simulink for my matlab function. Is there any function/command which can help me automatically obtain the transfer function so that i can obtain the Characteristic equation for in my further program?
Lets say for my simulink transfer, i want the generator tf automatically being obtained during my online autotuning. See image below.
Any suggestion?? Thnk you for reading my query.
Nitesh

採用された回答

Nitesh
Nitesh 2015 年 9 月 20 日
Ny help guys??
  1 件のコメント
@Johannes
@Johannes 2015 年 9 月 25 日
Hello Nitesh,
you have to change the date type of the variable in which get_param writes the num or den. For example
a = get_param('test_tf/TF', 'Numerator');
a =
[5 2]
num = str2num(a)
num =
5 2
H=tf(num,den);
H =
5 s + 2
-------------
2 s^2 + s + 1
Continuous-time transfer function.
Regards, John

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

その他の回答 (1 件)

Nobel Mondal
Nobel Mondal 2015 年 9 月 19 日
If your model is loaded, you can access the parameter values for a block using "get_param" api.
Say, you have a model "myModel.slx" and you would like to get the coefficients of a "Transfer Fcn" block named "myTFBlock"
>> load_system('myModel') % If your model is already loaded, skip this
>> numeratorVal = get_param('myModel/myTFBlock', 'Numerator');
>> denomVal = get_param('myModel/myTFBlock', 'Denominator');
Hope this helps. Thanks.
  1 件のコメント
Nitesh
Nitesh 2015 年 9 月 20 日
Thank you Nobel Mondal.
This solved half of my problem im having with. I would like to have a equation on the command window lets say in the s-domain. the get _param is fine i suppose bt not as expected output when i want it in S-domain.
s=fotf('s');
numeratorVal = get_param('online_sim2/TF', 'Numerator')
denomVal = get_param('online_sim2/TF', 'Denominator')
using the plant lets say the equation i want back from the simulink is 1/(s^2+2s+1)
bt when i use fraction order transfer function call as fotf, den i have some compution. using tf as in tf([numeratorVal],[denomVal]) doesnt work.
the code is given below.
plant=fotf([numeratorVal],[denomVal])
i want like this when i use the above command.
1
------------
s^2+2s+1
the total output is given below:
how can i get the equation in s-domain like a normal tf similar like in the simulink??? please help...
this is my simulink block.

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

カテゴリ

Help Center および File ExchangeCreate Large-Scale Model Components についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by