HELPPP!!! polynomial to transfer function?

8 次查看(过去 30 天)
Im am having trouble converting from a polynomial to a transfer function automatically. My matlab program computes a denominator for example x^2+2x+1, and a numerator say x^2+3x+2 (x is a symbol). Now i want the program to automatically make a transfer function from these polynomials. I tried collecting the coefficients like eq1=coeffs(x^2+2x+1) and eq2=coeffs(x^2+3x+2) and put these in tf(eq1,eq2) and i get an error. I found that if i copy paste the results like eq1=[1 2 1] and eq2=[1 3 2] i get what i want. I have really big polynomials to deal with and need the program to do it automatically. thanks for the help...

采纳的回答

Teja Muppirala
Teja Muppirala 2011-5-6
Here's an idea.
syms x
eq1 = x^2+2*x+1
eq2 = x^2+3*x+2
s = tf('s')
eq1_s = strrep(char(eq1),'x','s');
eq2_s = strrep(char(eq2),'x','s');
G = eval(eq1_s) / eval(eq2_s)
  1 个评论
Alex
Alex 2011-5-6
BOOOOOOOOOMMMMMMMM!!!! wowww i spent like 5 hours on this.
Thanks Teja

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by