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...
댓글 수: 0
채택된 답변
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)
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Symbolic Math Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!