creating a transfer function from a determinant

조회 수: 6 (최근 30일)
Michael Gibson
Michael Gibson 2019년 12월 2일
댓글: Michael Gibson 2019년 12월 2일
Hey Guys,
So I'm trying to create a transfer function in matlab using the determinants and state space equations via linear algebra. The thing is I can manually pull the coefficients out of the results and plug them into the tf command, but I have to fiddle with the input numbers to get the desired result, so I'd rather not have to manually plug that in every time. Any suggestions?
syms s
m = 5;
k = 10;
b = 50;
m_c = 0.1*m;
k_c = k;
b_c = b;
R_wc = 10;
T_c = 10;
H = (b_c*R_wc)/(b_c*R_wc+T_c^2);
V_1 = det([-(H*T_c^2-b)/R_wc -k -H*T_c^2/(m_c*R_wc) -H*k_c*T_c^2/(b_c*R_wc); ...
1 s 0 0; ...
-H*T_c^2/R_wc 0 s-H*T_c^2/(m_c*R_wc) -H*k_c*T_c^2/(b_c*R_wc); ...
-H*T_c^2/(b_c*R_wc) 0 -H*T_c^2/(m_c*b_c*R_wc) s-(k_c*H*T_c^2-H*R_wc)/(b_c^2*R_wc)]);
V_2 = det([H*T_c/R_wc -k -H*T_c^2/(m_c*R_wc) -H*k_c*T_c^2/(b_c*R_wc); ...
0 s 0 0; ...
H*T_c/R_wc 0 s-H*T_c^2/(m_c*R_wc) -H*k_c*T_c^2/(b_c*R_wc); ...
H*T_c/(b_c*R_wc) 0 -H*T_c^2/(m_c*b_c*R_wc) s-(k_c*H*T_c^2-H*R_wc)/(b_c^2*R_wc)]);
den = det([s-(H*T_c^2-b*R_wc)/(m*R_wc) -k -H*T_c^2/(m_c*R_wc) -H*k_c*T_c^2/(b_c*R_wc); ...
1/m s 0 0; ...
-H*T_c^2/(m*R_wc) 0 s-H*T_c^2/(m_c*R_wc) -H*k_c*T_c^2/(b_c*R_wc); ...
-H*T_c^2/(m*b_c*R_wc) 0 -H*T_c^2/(m_c*b_c*R_wc) s-(k_c*H*T_c^2-H*R_wc)/(b_c^2*R_wc)]);
G_vel = vpa(V_1/den,10)
G_vel_tf = tf([4.257211935 242.9349118 271.8731897 0.07907120546],[-1.0 19.8925608 269.8083056 54.43899276 0.01581424109]);

채택된 답변

David Wilson
David Wilson 2019년 12월 2일
How about:
[num,den] = numden(G_vel)
G_vel_tf = tf(sym2poly(num), sym2poly(den))
  댓글 수: 1
Michael Gibson
Michael Gibson 2019년 12월 2일
Thanks for answering, but I managed to figure it out while I was waiting. Here's what I ended up doing:
v_1 = coeffs(V_1);
v_1 = double(fliplr(v_1));
v_2 = coeffs(V_2);
v_2 = double(fliplr(v_2));
Den = coeffs(den);
Den = double(fliplr(Den));
G_vel_tf = tf([v_1],[Den*m]);
G_F_c = vpa(V_2/den,10);
G_F_C_tf = tf([v_2],[Den*m]);
bode(G_vel_tf)
bode(G_F_C_tf)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by