Convert a Simulink Model into a transfer function with constant names

2 views (last 30 days)
Hello,
is it possible to convert a Simulink-Model to a transfer function and keep the constant name of the used variables in the formular instead of getting a solved numeric value?
Example:
%Get Transferfkt
SYS=linmod('Model')
Tss=ss(SYS.a,SYS.b,SYS.c,SYS.d)
[n,d]=tfdata(Tss,'v')
T=tf(n,d)
This works pretty good but i get numeric values and s in my transfer function.
I would like to have something like G(s)=1/((K1*K2)/K3)s instead of G(s)=1/0.235235s, where K1,K2,K3 are variables from the Matlabworkspace which set up the Simulink Model. With the constants in the transferfunction i am able to see which constant are responsible for which timefactor.
Thanks in Advance
Beni
  1 Comment
Sriram Narayanan
Sriram Narayanan on 20 May 2015
Edited: Sriram Narayanan on 20 May 2015
Hi Benjamin,
It is not possible to retain the variables used in the Transfer function because the "linmod" command could actually be linearizing a complex nonlinear model which could consist of 100 such variables in the base workspace and this process of retaining the variable could get convoluted.
In general, when returning a transfer function, MATLAB/Simulink needs to know the values of the variables used to create the transfer function. These variables are substituted by their explicit values and simplified if required.
For example, try the following lines of code:
>> K1 = 4;
>> sys = tf(K1,[K1^2 1])
4
--------
16 s + 1
Continuous-time transfer function.

Sign in to comment.

Answers (0)

Categories

Find more on Simulink in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!