Control package: Difference between revisions

272 bytes added ,  29 September 2015
Line 560: Line 560:


<!-- {{SyntaxHighlight| -->
<!-- {{SyntaxHighlight| -->
{{Code|Creating the transfer function for the inverted pendulum|<syntaxhighlight lang="octave" style="font-size:13px">
{{Code|Creating the transfer functions for the inverted pendulum|<syntaxhighlight lang="octave" style="font-size:13px">
  m = 0.15;
  m = 0.15;
  l = 0.314;
  l = 0.314;
Line 567: Line 567:
  g = 9.80665;
  g = 9.80665;
  b = 20;
  b = 20;
c = 0;
  G1 = tf([m*l^2+I b -m*g*l],
  G1 = tf([m*l^2+I b -m*g*l],
         [(M+m)*(m*l^2+I)-m^2*l^2 (M+m)*b+(m*l^2+I)*c -(M+m)*m*g*l+b*c -m*g*l*c 0])
         [(M+m)*(m*l^2+I)-m^2*l^2 (M+m)*b+(m*l^2+I)*c -(M+m)*m*g*l+b*c -m*g*l*c 0])
Line 572: Line 573:
         [(M+m)*(m*l^2+I)-m^2*l^2 (M+m)*b+(m*l^2+I)*c -(M+m)*m*g*l+b*c -m*g*l*c])
         [(M+m)*(m*l^2+I)-m^2*l^2 (M+m)*b+(m*l^2+I)*c -(M+m)*m*g*l+b*c -m*g*l*c])
</syntaxhighlight>}}
</syntaxhighlight>}}
and by invoking the bode command
<!-- {{SyntaxHighlight| -->
{{Code|Bode plot for the inverted pendulum|<syntaxhighlight lang="octave" style="font-size:13px">
bode(G1);
bode(G2);
</syntaxhighlight>}}
One obtains the Bode plots of the two transfer functions.


==References==
==References==
501

edits