How can I represent a transfer function interms of symbolic variables? Apparently tf(num, den) can only take numeric values.
8 views (last 30 days)
Show older comments
How can I represent a transfer function interms of symbolic variables. Apparently tf(num, den) can only take numeric values. I have also tried sym2poly() function, but that also generates errors.
syms theta(t) J b r I l B L F phi
theta_p = diff(theta, t);
theta_pp = diff(theta, t, 2);
func = J*theta_pp + b*theta_p - 2*r*I*l*B == -L*F*sin(phi);
Sol = dsolve(func, theta(0)==0, theta_p(0)==0);
TF = laplace(Sol)
%pretty(TF);
[symNum,symDen] = numden(TF) %Get num and den of Symbolic TF *****all is good untill this point****
%TFnum = sym2poly(symNum) %Convert Symbolic num to polynomial
% TFden = sym2poly(symDen); %Convert Symbolic den to polynomial
% ans =tf(TFnum,TFden);
0 Comments
Answers (2)
madhan ravi
on 28 Dec 2018
Edited: madhan ravi
on 28 Dec 2018
Might help :
Note: sin is noticed in your equation so sym2poly cannot be used.
Walter Roberson
on 28 Dec 2018
syms theta(t) J b r I l B L F phi s
theta_p = diff(theta, t);
theta_pp = diff(theta, t, 2);
func = J*theta_pp + b*theta_p - 2*r*I*l*B == -L*F*sin(phi);
Sol = dsolve(func, theta(0)==0, theta_p(0)==0);
TF = laplace(Sol)
[symNum,symDen] = numden(simplify(TF)) %Get num and den of Symbolic TF
NumCoeff = coeffs(symNum,s,'all');
DenCoeff = coeffs(symDen,s,'all');
The transfer function would then logically be tf(NumCoeff, DenCoeff)
But only logically. The Control System Toolbox does not support symbolic coefficients.
The Control System Toolbox does support tuneable systems. See the discussion at https://www.mathworks.com/matlabcentral/answers/305339-how-to-create-a-transfer-function-with-gain-k#answer_236890 . These are not symbolic coefficients.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!