Control System Toolbox の 伝達関数オブジェクトを Symbolic Math Toolbox のシンボリックオブジェクトに変換することはできますか?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
以下同様に伝達関数 "t" を定義しています。
t = tf(1:3,4:6)
Transfer function:
s^2 + 2 s + 3
---------------
4 s^2 + 5 s + 6
得られた伝達関数オブジェクトをシンボリックオブジェクトに変換して CCODE、FORTRAN 及び LATEX 関数を適用したいと考えています。方法を教えてください。
Akzeptierte Antwort
MathWorks Support Team
am 1 Mai 2013
以下同様に伝達関数オブジェクトをシンボリックオブジェクトに変換することが可能です。
t = tf(1:3,4:6);
[num,den] = tfdata(t);
syms s
t_sym = poly2sym(cell2mat(num),s)/poly2sym(cell2mat(den),s)
上記コードの実行結果が以下の通りです。
t_sym =
(s^2+2*s+3)/(4*s^2+5*s+6)
後段の処理で以下同様に t_sym オブジェクトに対して Symbolic Math Toolbox の関数 CCODE、FORTRAN または LATEX を利用します。
c = ccode(t_sym)
f = fortran(t_sym)
l = latex(t_sym)
以下の結果が表示されます。
c =
t0 = (s*s+2.0*s+3.0)/(4.0*s*s+5.0*s+6.0);
f =
t0 = (s**2+2*s+3)/(4*s**2+5*s+6)
l =
{\frac {{s}^{2}+2\,s+3}{4\,{s}^{2}+5\,s+6}}
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 変換 finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!