How to substitute tf('s') variables into a symbolic expression

조회 수: 46 (최근 30일)
Qian Feng
Qian Feng 2017년 5월 20일
답변: Walter Roberson 2017년 5월 23일
I am dealing with the following problem.
syms y z
r = 1; n = 3; A1 = rand(n); A2 = rand(n); A3 = rand(n); A4 = rand(n) + y*rand(n);
s = tf('s');
A = ( z*eye(n) - 1 - A2*exp(-r*z) - A3*z*exp(-r*z) - int( A4*exp(y*z), y, -r,0) )^(-1);
P = subs(A,z,s);
However, the subs function seems to be incompatible with symbolic variable z. On the other hand, the expression int( A4*exp(y*z), y, -r,0) cannot be handled via tf('s'), so I need to first apply a symbolic representation here.
Note that I here dealing with a delay system with a distributed delay, not just a simple LTI finite dimensional system.
  댓글 수: 4
Star Strider
Star Strider 2017년 5월 20일
The ‘s’ and ‘z’ variables have specific meanings in the Toolboxes that deal with discrete and continuous transfer functions. It is not permitted to substitute other variables for them.
Qian Feng
Qian Feng 2017년 5월 20일
편집: Walter Roberson 2017년 5월 23일
syms y z
This is the syntax I declared in my code. Since z is not a transfer function variable, I think there would be no problem here.

댓글을 달려면 로그인하십시오.

답변 (2개)

Walter Roberson
Walter Roberson 2017년 5월 23일

Sebastian K
Sebastian K 2017년 5월 22일
Hi Qian,
There are several issues with the code snippet you posted:
1. The correct syntax of the "subs" function is
subs(S,OLD,NEW)
In your case, you are calling the function as
P = subs(A,s,z);
which means that in the expression "A", you are trying to replace the variable "s" with "z". However currently there is no "s" in "A", but just "z" and "y". I believe you might be providing the variables "s" and "z" in the wrong order.
2. The bigger issue with this code snippet is that the "subs" function will not accept "s" as an argument in the first place. This is because "s" is not a symbolic or numeric variable, but rather it is a "TF" object. The "subs" function does not support this data type as an input argument.
I am not sure what your ultimate objective is, so I will not be able to offer very specific recommendations. However I believe you should try to change your approach on how you are modeling/representing your system.
For instance, are you trying to first create a symbolic expression using "syms" variables, and then convert it to a transfer function by substituting "s"? This will not be possible by simply using "subs" or any other built-in MATLAB function. However there might be some File Exchange submissions that would let you do this.
Your symbolic expression contains an integral. I believe it might not be possible for you to convert this to an s-domain transfer function object in any case, because integrals (even if they represent distributed delays) are not supported in "TF" objects.
If you are trying to do symbolic operations such as integration, you should probably just use symbolic variables and not try to convert it to a transfer function object. However if you are trying to do some analysis with your transfer function with distributed delays, I would recommend you try to model this system in Simulink and do the analysis there.
I hope this helps.
Sebastian
  댓글 수: 2
Qian Feng
Qian Feng 2017년 5월 22일
Thank you, the mistake has been corrected.
Qian Feng
Qian Feng 2017년 5월 22일
편집: Qian Feng 2017년 5월 23일
I am trying to calculate the H-infinity norm of a linear neutral distributed delay system. I understand that tf class variable cannot mixed with symbolic variables. However, the dilemma here converges to the term int( A4*exp(y*z), y, -r,0). As you have rightly pointed out, this integration cannot be calculated within the environment of tf class variable, and it would be unrealistic sometime to calculate it via symbolic variables and then write then down manually via tf variables. So that is the reason I asked if there is anyway to transfer a symbolic expression into a tf expression.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by