How to get tf() to display as a figure to use in a report?

112 次查看(过去 30 天)
I have a project I'm doing and I'd like to take the output of of tf() which gives the transfer function of the filter object I'm using and display it outside of the command window. Since I'm writing a report I would like to just copy and paste the figure into a Word file the same way I would copy a graph/plot. Is this possible? I know I can copy and paste the output of the command window but I would like it to be formatted correctly like a standard equation instead of manually entering each coeffecient into word to display the equation. I've searched around but I haven't come across anything similar. Basically, I'm just looking to see if there is a short command I maybe overlooked in the documentation.

采纳的回答

Clayton Gotberg
Clayton Gotberg 2021-4-26
I'm not sure if there's a specific function, but as a workaround you can try the below code in a MATLAB Live Script.
syms s
[num, den] = tfdata(transfer_function);
eqn_top = poly2sym(num,s);
eqn_bot = poly2sym(den,s);
result = eqn_top/eqn_bot
On the side, this should print the system's transfer function, formatted like an equation. You right-click to copy it in standard, LaTeX or MathML formats (I think Windows equation editor can understand LaTeX).
I ran this code with a test system and got this output:
  4 个评论
Clayton Gotberg
Clayton Gotberg 2021-4-26
Thank you! That's actually a huge help to me too as I'm in the middle of writing a few math-heavy papers where I've already done the heavy lifting at least once in MATLAB.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Symbolic Math Toolbox 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by