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

조회 수: 10 (최근 30일)
Joshua
Joshua 2014년 12월 3일
댓글: Fabio Gavilan 2022년 4월 28일
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
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에서 Digital Filter Analysis에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by