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

조회 수: 114 (최근 30일)
Christopher Mood
Christopher Mood 2021년 4월 25일
댓글: Star Strider 2021년 4월 26일
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.
Star Strider
Star Strider 2021년 4월 26일
My pleasure!

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

추가 답변 (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