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

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 件のコメント

Adam
Adam 2014 年 12 月 3 日
What 's' term? You have d, tf, g, a and b in your question.
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 件のコメント

Joshua
Joshua 2014 年 12 月 3 日
Could you please elaborate as I am unable to understand what your solution does.
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.

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

カテゴリ

製品

質問済み:

2014 年 12 月 3 日

コメント済み:

2022 年 4 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by