How to replace variable 's' in the transfer function with another variable

15 次查看(过去 30 天)
Consider a=1 and b=[1 2]; d=tf(a,b); how do we replace the 's' term in d with (g+1) or (g+1)/(g-2)? Is that even possible?
  2 个评论
Joshua
Joshua 2015-1-8
The transfer function is d=s/((s+1)(s+2)). Can i replace the 's' with any other variable like 'g+1' or '(g+1)/(g+2)'?

请先登录,再进行评论。

回答(1 个)

Andrei Bobrov
Andrei Bobrov 2014-12-3
yourTransferfunction = @(g)d(g+1);
  3 个评论
swarmer
swarmer 2020-10-22
This is known as an Anonymous Function. It is similar to lambdas from other programming like Python. Here is Wiki link if anyone wants to read into it further: https://en.wikipedia.org/wiki/Anonymous_function
Fabio Gavilan
Fabio Gavilan 2022-4-28
If you fill in yourTransferfunction(1) you get:
"Error using indexing Subscript no. 2 is out of range."
This does not change the variable in the expected way.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Testing Frameworks 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by