Effacer les filtres
Effacer les filtres

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

71 vues (au cours des 30 derniers jours)
Christopher Mood
Christopher Mood le 25 Avr 2021
Commenté : Star Strider le 26 Avr 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.

Réponse acceptée

Clayton Gotberg
Clayton Gotberg le 26 Avr 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:
  4 commentaires
Clayton Gotberg
Clayton Gotberg le 26 Avr 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.
Star Strider
Star Strider le 26 Avr 2021
My pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)


En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by