501
edits
Line 454: | Line 454: | ||
<!-- {{SyntaxHighlight| --> | <!-- {{SyntaxHighlight| --> | ||
{{Code|Creating a transfer function and plotting its response|<syntaxhighlight lang="octave" style="font-size:14px"> | {{Code|Creating a transfer function and plotting its response|<syntaxhighlight lang="octave" style="font-size:14px"> | ||
T1=0.4; | T1 = 0.4; # time constant | ||
P=tf([1], [T1 1]) | P = tf([1], [T1 1]) # create transfer function model | ||
step(P,2) # plot step response | step(P, 2) # plot step response | ||
#add some common markers like the tangent line at the origin, which crosses lim(n->inf) f(t) at t=T1 | #add some common markers like the tangent line at the origin, which crosses lim(n->inf) f(t) at t=T1 | ||
hold on | hold on | ||
plot ([0 T1], | plot ([0 T1], [0 1], "g") | ||
plot ([T1 T1], | plot ([T1 T1], [0 1], "k") | ||
plot ([0 T1], | plot ([0 T1], [1-1/e 1-1/e], "m") | ||
hold off | hold off | ||
</syntaxhighlight>}} | </syntaxhighlight>}} | ||
Line 468: | Line 468: | ||
[[File:Pt1.png|600px]] | [[File:Pt1.png|600px]] | ||
Try also <code style="font-size:14px; border:solid lightgray 1px; padding: 2px">bode(P)</code> | Try also <code style="font-size:14px; border:solid lightgray 1px; padding: 2px">bode(P)</code> (a first order low-pass filter has -3db magnitude at f=1/T1). | ||
(a first order low-pass filter has -3db magnitude at f=1/T1) | |||
=== Inverted Pendulum === | === Inverted Pendulum === |
edits