501
edits
Line 471: | Line 471: | ||
==== Bode Diagram for TikZ/PGFplots ==== | ==== Bode Diagram for TikZ/PGFplots ==== | ||
We use the same system as before but we draw now with | We use the same system as before but we draw now with <code style="font-size:14px; border:solid lightgray 1px; padding: 2px">bode(P)</code> a bode diagram. | ||
The output is | The output is written to a .csv file. | ||
<!-- {{SyntaxHighlight| --> | <!-- {{SyntaxHighlight| --> | ||
{{Code|Creating a transfer function and | {{Code|Creating a transfer function and calculating its bode diagram|<syntaxhighlight lang="octave" style="font-size:14px"> | ||
T1 = 0.4; # time constant | |||
P = tf([1], [T1 1]); | |||
[mag, pha, w] = bode(P); | |||
csvwrite("dat/bode_p.csv", [w', 20*log10(mag), pha]); | |||
</syntaxhighlight>}} | </syntaxhighlight>}} | ||
Line 487: | Line 487: | ||
<!-- {{SyntaxHighlight| --> | <!-- {{SyntaxHighlight| --> | ||
{{Code|Creating a | {{Code|Creating a bode diagram with pgfplots|<syntaxhighlight lang="latex" style="font-size:14px"> | ||
\documentclass[tikz]{standalone} | \documentclass[tikz]{standalone} | ||
\usepackage{pgfplotstable} | \usepackage{pgfplotstable} | ||
Line 525: | Line 525: | ||
[[File:bode_p.png]] | [[File:bode_p.png]] | ||
It can be seen that a first order low-pass filter has <math display="inline">-3\,db</math> magnitude at <math display="inline">f=1/T_1</math>. | |||
=== Inverted Pendulum === | === Inverted Pendulum === |
edits