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

112 views (last 30 days)
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.

Accepted Answer

Clayton Gotberg
Clayton Gotberg on 26 Apr 2021
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:
Clayton Gotberg
Clayton Gotberg on 26 Apr 2021
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.

Sign in to comment.

More Answers (0)


Find more on Symbolic Math Toolbox 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!