Skip to content

Instantly share code, notes, and snippets.

@mick001
Last active January 13, 2020 00:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mick001/4965b621a4763ecc809b6670a61b4392 to your computer and use it in GitHub Desktop.
Save mick001/4965b621a4763ecc809b6670a61b4392 to your computer and use it in GitHub Desktop.
Balancing a ball on a beam article code.
k = -7.0071;
s = tf('s');
G = k/s^2;
% PD controller
R = -(0.38 + 0.5*50/(1+50/s));
% Design a PD controller for the unit feedback loop
L = series(R,G);
sys = feedback(L, 1);
% Phase margin
margin(L)
% Step response
step(sys)
% Root locus
rlocus(L)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment