Control System Toolbox の 伝達関数オブジェクトを Symbolic Math Toolbox のシンボリックオブジェクトに変換することはできますか?
1 view (last 30 days)
Show older comments
以下同様に伝達関数 "t" を定義しています。
t = tf(1:3,4:6)
Transfer function:
s^2 + 2 s + 3
---------------
4 s^2 + 5 s + 6
得られた伝達関数オブジェクトをシンボリックオブジェクトに変換して CCODE、FORTRAN 及び LATEX 関数を適用したいと考えています。方法を教えてください。
Accepted Answer
MathWorks Support Team
on 1 May 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 Comments
More Answers (0)
See Also
Categories
Find more on 変換 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!