How to get tf() to display as a figure to use in a report?
21 views (last 30 days)
Christopher Mood on 25 Apr 2021
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 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.
[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: