MATLAB Answers

Is there a way to return variable names instead of values when constructing TF?

2 views (last 30 days)
Alex Smith
Alex Smith on 7 Apr 2018
Answered: Prajit T R on 10 Apr 2018
Is there a way of getting MATLAB to return variable names instead of values when computing? As an example if I were to run:
J = 0.0000889754 ;
b = 0.00001 ;
Ke = 0.0366 ;
Kt = 0.54233 ;
R = 1.47 ;
L = 0.0082 ;
l = 0.02 ;
TFM = tf([ Kt ] , [ (J*L) , (J*R+L*b) , (R*b + Ke*Kt) ])
Is there a way of having the result display as:
JLs^2 + (JR+Lb)s + (Rb+KeKt)
as opposed to:
7.296e-7 s^2 + 0.0001309s + 0.01986
I'm trying to simplify down a controller, but don't have actual values for it yet and the simplification is taking about an A4 page per coefficient per function so it'd be a lot more confident about the calculation if I wasn't involved to inevitably make a mistake somewhere down the line.

Answers (1)

Prajit T R
Prajit T R on 10 Apr 2018
Hi Alex
Unfortunately the only certain variables permitted to print out as transfer function. If you try to give other names in the 'Variable' property, you will get the following error message:
The "Variable" property must be set to 's' or 'p' for continuous-time systems, and to one of the following: 'z', 'q', 'z^-1', or 'q^-1' for discrete-time systems.

Community Treasure Hunt

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

Start Hunting!