Symbols in a transfer function:

15 ビュー (過去 30 日間)
Zain Ali
Zain Ali 2023 年 2 月 11 日
コメント済み: Star Strider 2023 年 2 月 11 日
Im trying to get a step response for a transfer function but having trouble implementing it in matlab.
H(s)=K/(t*s+1)
Code:
sym k
sym t
sys = tf(k,[t 1])
step(sys)

採用された回答

Star Strider
Star Strider 2023 年 2 月 11 日
編集済み: Star Strider 2023 年 2 月 11 日
The Control System Toolbox functions require numerical values.
It is possible to create an anonymous function with your code, and you can then use numerical values for ‘k’ and ‘t’ with it —
sys = @(k,t) tf(k,[t 1]);
k = 0.5;
t = 2;
figure
step(sys(k,t))
grid
The Symbolic Math Toolbox can be used to derive transfer functions. The sym2poly and double functions are helpful in that situation.
EDIT — Corrected typographical error.
.
.
  2 件のコメント
Zain Ali
Zain Ali 2023 年 2 月 11 日
Thank you!
Star Strider
Star Strider 2023 年 2 月 11 日
As always, my pleasure!

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

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2023 年 2 月 11 日
tf() is part of the Control System Toolbox, which is not designed at all to be able to use symbolic expressions.
The Control System Toolbox has no capacity to draw a family of plots -- the plots for all of the different shapes that can be generated by using different K and t values. K might be negative. K might be 0. t might be negative. K or t might be complex.
You can work symbolically, such as
syms k t s
sys = k/(t*s + 1)
sys = 
isys = ilaplace(sys, s)
isys = 
but the symbolic toolbox has no way to draw families of plots either.
  3 件のコメント
Walter Roberson
Walter Roberson 2023 年 2 月 11 日
The Control System Toolbox has very limited capacity to work with systems with parameters in them. There is some capacity; see https://www.mathworks.com/matlabcentral/answers/305339-how-to-create-a-transfer-function-with-gain-k#answer_236890 . In each case, at any time the parameter is considered to have a specific value; the facilities that exist are there to make it easier to change the value of the parameter, potentially using automatic tuning.
Zain Ali
Zain Ali 2023 年 2 月 11 日
Thank You!

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

Community Treasure Hunt

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

Start Hunting!

Translated by