Why my - tf2sym - command is not working?

13 vues (au cours des 30 derniers jours)
Enes Emre Öztürk
Enes Emre Öztürk le 19 Nov 2023
Hello, i am trying to do my homework but my tf2sym command is not working.
İt says "Unrecognized function or variable 'tf2sym'."
What can i do about it?
I looked to add-ons and i have all toolboxes currently, it shows. Please can someone help me?
Gs=tf(1,[1 10 27 18]);
Gss= tf2sym(Gs)

Réponses (2)

Sam Chak
Sam Chak le 19 Nov 2023
I guess you want to convert the transfer function to state-space nodel.
Gs = tf(1, [1 10 27 18])
Gs = 1 ------------------------ s^3 + 10 s^2 + 27 s + 18 Continuous-time transfer function.
%% Method 1: Using tf2ssm()
[A, B, C, D] = tf2ssm(1, [1 10 27 18])
A = 3×3
-10 -27 -18 1 0 0 0 1 0
B = 3×1
1 0 0
C = 1×3
0 0 1
D = 0
%% Method 2: Directly using ss() function
Gss = ss(Gs)
Gss = A = x1 x2 x3 x1 -10 -6.75 -2.25 x2 4 0 0 x3 0 2 0 B = u1 x1 0.25 x2 0 x3 0 C = x1 x2 x3 y1 0 0 0.5 D = u1 y1 0 Continuous-time state-space model.

Star Strider
Star Strider le 19 Nov 2023
If you want to conovert that transfer function to a symbolic variable, try this —
Gs=tf(1,[1 10 27 18]);
Gss= tf2sym(Gs)
Gss = 
whos Gss
Name Size Bytes Class Attributes Gss 1x1 8 sym
function symtf = tf2sym(sys)
TF = tf(sys);
n = TF.Numerator;
d = TF.Denominator;
s = sym('s');
symtf = poly2sym(n,s) / poly2sym(d,s);
end
I can find no reference to any function called ‘tf2sym’ so I created one.
.

Catégories

En savoir plus sur Stability Analysis dans Help Center et File Exchange

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by