HELPPP!!! polynomial to transfer function?
8 views (last 30 days)
Show older comments
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...
0 Comments
Accepted Answer
Teja Muppirala
on 6 May 2011
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)
More Answers (0)
See Also
Categories
Find more on Symbolic Math Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!