Digital Control Systems: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(54 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
===Links=== |
===Links=== |
||
====Textbooks==== |
|||
**[http://www.me.unm.edu/~starr/teaching/me581/textbook.pdf Introduction to Applied Digital Control, Greg Starr, University of New Mexico] |
**[http://www.me.unm.edu/~starr/teaching/me581/textbook.pdf Introduction to Applied Digital Control, Greg Starr, University of New Mexico] |
||
***[http://www.me.unm.edu/~starr/teaching/me581.html Greg's ME481/ME581 web pages] contain solutions to the book problems and other things. |
***[http://www.me.unm.edu/~starr/teaching/me581.html Greg's ME481/ME581 web pages] contain solutions to the book problems and other things. |
||
**[http://www.control.utoronto.ca/people/profs/francis/sd_book.pdf Optimal Sampled-Data Control Systems, Chen & Francis] |
**[http://www.control.utoronto.ca/people/profs/francis/sd_book.pdf Optimal Sampled-Data Control Systems, Chen & Francis] |
||
**[http://faculty.ksu.edu.sa/hedjar/Documents/CEN455/Digital%20Control%20Systems.pdf Digital Control Systems Notes] Irfan Ahmed |
|||
**[http://www.ee.nchu.edu.tw/Pic/CourseItem/4559_digital_control_engineering_2nd_edition.pdf Digital Control Engineering] Fadali & Visioli |
|||
**[http://een.iust.ac.ir/profs/jahed/digital%20controll/e%20book/discrete-time_control_systems.pdf Discrete Time Control Systems] Ogata |
|||
**[http://een.iust.ac.ir/profs/jahed/digital%20controll/e%20book/discrete-time_control_systems.pdf Control System Engineering, Chapter 13 (Digital Control)] Norman Nise |
|||
**[http://uav.ece.nus.edu.sg/~bmchen/courses/ee3304.pdf Digital Control Systems Notes] Ben Chen |
|||
**[https://www.springer.com/cda/content/document/cda_downloaddocument/9781846280559-c1.pdf?SGWID=0-0-45-166313-p52482958 Computer Control Systems] |
|||
**[http://santcas.com/uploads/2/8/1/3/2813995/digital_control_system_analysis_and_design_3rd_edition_phillips.pdf Digital Control System Analysis and Design, 3rd Ed., Philips] |
**[http://santcas.com/uploads/2/8/1/3/2813995/digital_control_system_analysis_and_design_3rd_edition_phillips.pdf Digital Control System Analysis and Design, 3rd Ed., Philips] |
||
**[http://en.wikibooks.org/wiki/Control_Systems Control Systems and Control Engineering] |
**[http://en.wikibooks.org/wiki/Control_Systems Control Systems and Control Engineering] |
||
**[http://www.ece.rutgers.edu/~orfanidi/intro2sp/orfanidis-i2sp.pdf Introduction to Signal Processing] |
|||
**[http://eceweb1.rutgers.edu/~gajic/psfiles/ Zoran Gajic's Book on Control Systems] (Continuous & Discrete) and some other documents. Look for the documents entitled Chapter N. |
|||
**[http://nptel.ac.in/courses/108103008/25# NPTEL Course on Digital Control] |
|||
====Lectures==== |
|||
*2016 |
|||
**[http://people.wallawalla.edu/~Rob.Frohne/ClassHandouts/Digital_Control/LQR%20Outline.pdf LQR Derivation Outline from Class] |
|||
**[http://people.wallawalla.edu/~Rob.Frohne/ClassHandouts/Digital_Control/Kalman%20Filters%20Derivation.pdf Kalman Filters Derivation Outline from Class] |
|||
***[http://people.wallawalla.edu/~Rob.Frohne/ClassHandouts/Digital_Control/Kalman%20Filter%20Summary.pdf Kalman Filter Summary from Class] |
|||
*2014 |
|||
===MATLAB/Octave=== |
|||
**[http://www.stanford.edu/class/archive/ee/ee392m/ee392m.1056/Lecture5_Digital.pdf Sampled Time Control] |
|||
**[http://unitedthc.com/CTL/dig_ctl.pdf Duy-Ky Nguyen's Concise Digital Control Notes] I like this presentation. |
|||
**[http://eceweb1.rutgers.edu/~gajic/psfiles/observers.pdf Zoran Gajic's notes on Observers.] This is a very short set of lecture notes that explains the why's of observers, with several interesting derivations. |
|||
**[http://cse.lab.imtlucca.it/~bemporad/automatic_control_course.html Professor Bemporad's Automatic Control Class Notes] These are very good. |
|||
***[http://cse.lab.imtlucca.it/~bemporad/teaching/ac/pdf/07-output_feedback.pdf Professor Bemporad's] presentation on the separation principle of state space regulator design (showing that the poles of the control setting are preserved even when using a full order observer). |
|||
**[http://ocw.mit.edu/courses/mechanical-engineering/2-154-maneuvering-and-control-of-surface-and-underwater-vehicles-13-49-fall-2004/lecture-notes/ MIT Class on Underwater Vehicle Control] |
|||
***[http://ocw.mit.edu/courses/mechanical-engineering/2-154-maneuvering-and-control-of-surface-and-underwater-vehicles-13-49-fall-2004/lecture-notes/lec19.pdf Linear Quadratic Regulators (Mathematically Deep)] |
|||
***[http://ocw.mit.edu/courses/mechanical-engineering/2-154-maneuvering-and-control-of-surface-and-underwater-vehicles-13-49-fall-2004/lecture-notes/lec20.pdf A Mathematically Involved, but Insightful Look at Kalman Filters.] It has some interesting remarks about the duality between the Kalman-Bucy Filter for continuous systems and the LQR algorithm for continuous systems. I expect the discrete versions are also duals. |
|||
**[http://www.cl.cam.ac.uk/~rmf25/papers/Understanding%20the%20Basis%20of%20the%20Kalman%20Filter.pdf Kalman Filter Applied to Cart in One Dimensional Motion] |
|||
**[https://www.youtube.com/watch?v=18TKA-YWhX0 Intuitive Lecture on Practical Kalman Filter given by Francis Grovers III] |
|||
**[http://greg.czerniak.info/guides/kalman1/ The first 80% of what you need to know about Kalman Filters from Greg Czerniak.] |
|||
**[http://www.academia.edu/1512888/Introduction_to_the_Kalman_Filter_and_its_Derivation Introduction the the Kalman Filter and its Derivation, Brent Perreault] |
|||
**[http://people.wallawalla.edu/~Rob.Frohne/ClassHandouts/Digital_Control/Kalman_1.pdf A Simple Introduction to the Kalman Filter] (This reference from Duy-Ky Nguyen has some excellent examples and very readable derivations.) |
|||
*Papers |
|||
**[http://docphdpersonalstuff.googlecode.com/svn/trunk/literature/an%20introduction%20to%20observers.pdf David Luenberger's Introduction to Observers] |
|||
**F.L. Lewis' LQR Explanations |
|||
***[http://www.uta.edu/utari/acs/Lectures/lqr.pdf F.L. Lewis Linear Quadratic Regulator Derivation and Examples] |
|||
***[http://www.uta.edu/utari/acs/ee5321/2013%20notes/2%20lqr%20dt%20and%20sampling.pdf F.L. Lewis Discrete LQR Derivation and Examples] This goes nicely with the above paper doing it for continuous time. |
|||
**[http://www.youtube.com/watch?v=St5L-ekOKGA Jake Abbott's lecture on the Linear Quadratic Regulator] |
|||
**[http://www.cs.unc.edu/~welch/media/pdf/kalman_intro.pdf Greg Welch & Gary Bishop's Introduction to Kalman Filters] |
|||
**[http://users.isr.ist.utl.pt/~mir/pub/kalman.pdf Maria Isabel Ribeiro paper on Kalman Filters] |
|||
**[https://www.control.isy.liu.se/research/reports/LicentiateThesis/Lic1085.pdf The Descriptor State Space Model] |
|||
**[https://nms.kcl.ac.uk/simon.salamon/P/dedm.pdf Relation Between Continuous Differential Equations and Discrete Difference Equations] |
|||
*2016 |
|||
**[http://ocw.mit.edu/courses/mechanical-engineering/2-004-systems-modeling-and-control-ii-fall-2007/lecture-notes/lecture05.pdf Equations of Motion for a DC Motor] |
|||
**[https://courses.engr.illinois.edu/ece486/documents/lecture_notes/state_space_realizations.pdf Controllable and Modal Canonical Forms of the State Space Representation] |
|||
===MATLAB/Octave/Scilab=== |
|||
====Gnu Octave==== |
|||
Gnu Octave is a free open source clone of MATLAB. I use it all the time in lieu of MATLAB, and it works well on my Ubuntu Linux OS. |
|||
*[http://laris.fesb.hr/digitalno_vodjenje/octave/doc/octave_30.html Octave Control Systems Toolbox] This is not the same thing that is on [http://octave.sourceforge.net/control/overview.html Octave Forge here]. |
*[http://laris.fesb.hr/digitalno_vodjenje/octave/doc/octave_30.html Octave Control Systems Toolbox] This is not the same thing that is on [http://octave.sourceforge.net/control/overview.html Octave Forge here]. |
||
*[[Digital Control Octave Scripts]] |
|||
====MATLAB/Simulink==== |
|||
*[http://ctms.engin.umich.edu/CTMS/index.php?aux=Activities_IOpack This page shows some neat experiments you can do with the ArduinoIO package which allows you to use an Arduino from Simulink/MATLAB.] You can also control an Arduino from any terminal program. It's license from Mathworks forbids its use with other software like Octave or Scilab, and probably from controlling an Arduino from your own program, unless it is for use with Mathworks software. |
|||
====Scilab/Xcos==== |
|||
Scilab is a MATLAB like program. It isn't as compatible with MATLAB as octave is, but it has Xcos, which is a GUI block manipulation tool very similar to Scilab. |
|||
*[https://atoms.scilab.org/toolboxes/arduino The Xcos ATOM toolbox] is very similar to ArduinoIO, but for the open source Scilab/Xcos environment. It works only on Windows at this time, but looking at the source leads me to believe that it would be easy to port it to Linux or OS X and it is fully open source. |
|||
====Pendulum Specific Scripts==== |
|||
=====Single Pendulum===== |
|||
<nowiki> |
|||
% Double Pendulum Parameters (Tentative: There are two pendulum setups, each with different parameters. I'm not sure which these go to.) |
|||
% This script is for balancing only the long rod. |
|||
% Run parameters |
|||
%f = input('Control Frequency (Hz) = '); |
|||
%Trun = input('Run Time (s) = '); |
|||
%f=130; |
|||
f=1000; |
|||
Trun=30; |
|||
kmax = round(f*Trun); |
|||
T = 1/f; |
|||
Maxpos = 0.25; % Max carriage travel +- 0.25 m |
|||
Maxangle = 0.175; % Max rod angle -- 10 deg |
|||
Maxvoltage = 20; % Max motor voltage, V |
|||
pstart = 0.005; % Carriage position starting limit, m |
|||
astart = 1*pi/180; % Angle starting limit, rad |
|||
g = 9.81; % m/s^2 Gravitational constant |
|||
% SYSTEM PARAMETERS |
|||
% Measured Mechanical Parameters |
|||
d1 = 0.323; % m Length of pendulum 1 (long) |
|||
d2 = 0.079; % m Length of pendulum 2 (short) |
|||
%mp1 = 0.0208; % kg Mass of pendulum 1 |
|||
mp1 = 0.0318; |
|||
%mp2 = 0.0050; % kg Mass of pendulum 2 |
|||
mp2 = 0.0085; |
|||
%m=.5; |
|||
m = 0.3163; % kg Mass of carriage |
|||
rd = 0.0254/2; % m Drive pulley radius |
|||
md = 0.0375; % kg Mass of drive pulley (cylinder) |
|||
%mc1 = 0.0036; % kg Mass of clamp 1* |
|||
%mc2 = 0.0036; % kg Mass of clamp 2* |
|||
mc1 = 0.0085; |
|||
mc2 = mc1; |
|||
% *Clamp Dimensions |
|||
% Rectangular 0.0254 x 0.01143 m |
|||
% The pivot shaft is 0.00714 m from the end |
|||
% Motor Parameters (Data Sheet) |
|||
Im = 43e-7; % kg m^2/rad Rotor moment of inertia |
|||
R = 4.09; % ohms Resistance |
|||
kt = 0.0351; % Nm/A Torque constant |
|||
ke = 0.0351; % Vs/rad Back emf constant |
|||
% Derived Mechanical Parameters |
|||
% kg m^2/rad Moment of inertia, clamp 1 |
|||
%Ic1 = mc1*(0.01143^2 + 0.0254^2)/12 + mc1*(0.0127-0.00714)^2; |
|||
Ic1 = mc1*(0.0098^2 + 0.0379^2)/12; |
|||
Ic2 = Ic1; % kg m^2/rad Moment of inertia, clamp 2 |
|||
Id = md*(rd^2)/2; % kg m^2/rad Moment of inertia, drive pulley |
|||
Imd = Im + Id; % kg m^2/rad Moment of inertia, combined |
|||
J1 = Ic1 + mp1*(d1^2)/3; % Total moment of inertia, pendulum 1 (long) |
|||
J2 = Ic2 + mp2*(d2^2)/3; % Total moment of inertia, pendulum 2 (short) |
|||
Jd = Im + Id; % Total moment of inertia, motor drive |
|||
Mc = m + mc1 + mc2; % Total carriage mass |
|||
% Friction Test Data |
|||
% Carriage Slope = 19 deg; Terminal Velocity xdotss = 0.312 m/s; From |
|||
% twincarriage.m; formula b = m g sin(theta)/xdotss |
|||
% Pendulum 1 (long) Exponent a1 = 0.0756 1/s; From longfit.m |
|||
% Pendulum 2 (short) Exponent a2 = 0.2922 1/s; From shortfit.m |
|||
% formula b = 2 a J |
|||
%alpha = 19; |
|||
alpha = 12.2; |
|||
%xdotss = 0.312; |
|||
xdotss = 0.4852; |
|||
%a1 = 0.0756; |
|||
%a2 = 0.2922; |
|||
a1 = 0.0185; |
|||
a2 = 0.012; |
|||
% Ns/m Viscous friction of carriage system |
|||
b = (Mc + mp1 + mp2)*g*sin(alpha*pi/180)/xdotss; |
|||
b1 = 2*a1*J1; % Nms/rad Viscous friction of pendulum 1 (rotational) |
|||
b2 = 2*a2*J2; % Nms/rad Viscous friction of pendulum 2 (rotational) |
|||
scale = [rd*2*pi/4096 2*pi/4096 -0.05/250]; |
|||
T = 1/f; |
|||
% The data above comes from the fweb wiki. |
|||
M=Mc; %mass of cart |
|||
m=mp1; %mass of pendulum 1 |
|||
b=b; %friction |
|||
l=d1/2; %length of pendulum |
|||
I=J1; %inertia of pendulum |
|||
%q=(M+m)*(l+m*l^2)-(m*l)^2; |
|||
%num=[m*l,0]; %numerator for transfer function |
|||
%den=[q,b*(l+m*l^2),-m*g*l*(M+m),-b*m*g*l]; %denominator for transfer function |
|||
%[A,B,C,D]=tf2ss(num,den) |
|||
%A,B,C,D matricies for the state space model |
|||
% x_vec is [x, x_dot, theta, theta_dot]' |
|||
% See the web site: https://www.library.cmu.edu/ctms/ctms/examples/pend/invpen.htm |
|||
A=[ 0 1 0 0; |
|||
0 ((-(I+m*l^2)*b)/(I*(M+m)+M*m*l^2)) ((m^2*g*l^2)/(I*(M+m)+M*m*l^2)) 0; |
|||
0 0 0 1; |
|||
0 ((-m*l*b)/(I*(M+m)+M*m*l^2)) ((m*g*l*(M+m))/(I*(M+m)+M*m*l^2)) 0]; |
|||
B=[ 0; |
|||
((I+m*l^2)/(I*(M+m)+M*m*l^2)); |
|||
0; |
|||
((m*l)/(I*(M+m)+M*m*l^2))]; |
|||
C=[ 1 0 0 0; |
|||
0 0 1 0]; |
|||
D=[ 0; |
|||
0]; |
|||
cont_sys = ss(A,B,C,D) |
|||
rank_ctrb = rank(ctrb(A,B)) |
|||
original_poles = eig(A) %poles for our system |
|||
</nowiki> |
|||
These Pendulum [[Parameters]] and control scripts are for our hardware. |
|||
===Z Transforms=== |
===Z Transforms=== |
||
Line 21: | Line 194: | ||
**Notice that this is really the same as [http://www.mathworks.com/help/matlab/ref/conv.html Polynomial Multiplication]. |
**Notice that this is really the same as [http://www.mathworks.com/help/matlab/ref/conv.html Polynomial Multiplication]. |
||
===Discretization=== |
===Discretization=== |
||
*[https://en.wikipedia.org/wiki/Discretization This is how the zero order hold works in MATLAB/octave.] |
*[https://en.wikipedia.org/wiki/Discretization This is how the c2d zero order hold works in MATLAB/octave.] It uses the "exact" solution to the discretization problem. |
||
* Also check Chapter 7.3 of [http://www.me.unm.edu/~starr/teaching/me581/textbook.pdf Greg Starr's book]. |
|||
===Scilab/Xcos=== |
|||
*[https://www.scilab.org/content/download/1107/10095/file/Xcos_beginners.pdf Xcos Beginners Guide] |
|||
*[http://www.iitg.ernet.in/trivedi/Downloads/scilab/book.pdf Scilab/Scicos Book] |
Latest revision as of 15:11, 3 June 2016
Links
Textbooks
- Introduction to Applied Digital Control, Greg Starr, University of New Mexico
- Greg's ME481/ME581 web pages contain solutions to the book problems and other things.
- Optimal Sampled-Data Control Systems, Chen & Francis
- Digital Control Systems Notes Irfan Ahmed
- Digital Control Engineering Fadali & Visioli
- Discrete Time Control Systems Ogata
- Control System Engineering, Chapter 13 (Digital Control) Norman Nise
- Digital Control Systems Notes Ben Chen
- Computer Control Systems
- Digital Control System Analysis and Design, 3rd Ed., Philips
- Control Systems and Control Engineering
- Introduction to Signal Processing
- Zoran Gajic's Book on Control Systems (Continuous & Discrete) and some other documents. Look for the documents entitled Chapter N.
- NPTEL Course on Digital Control
- Introduction to Applied Digital Control, Greg Starr, University of New Mexico
Lectures
- 2016
- 2014
- Sampled Time Control
- Duy-Ky Nguyen's Concise Digital Control Notes I like this presentation.
- Zoran Gajic's notes on Observers. This is a very short set of lecture notes that explains the why's of observers, with several interesting derivations.
- Professor Bemporad's Automatic Control Class Notes These are very good.
- Professor Bemporad's presentation on the separation principle of state space regulator design (showing that the poles of the control setting are preserved even when using a full order observer).
- MIT Class on Underwater Vehicle Control
- Linear Quadratic Regulators (Mathematically Deep)
- A Mathematically Involved, but Insightful Look at Kalman Filters. It has some interesting remarks about the duality between the Kalman-Bucy Filter for continuous systems and the LQR algorithm for continuous systems. I expect the discrete versions are also duals.
- Kalman Filter Applied to Cart in One Dimensional Motion
- Intuitive Lecture on Practical Kalman Filter given by Francis Grovers III
- The first 80% of what you need to know about Kalman Filters from Greg Czerniak.
- Introduction the the Kalman Filter and its Derivation, Brent Perreault
- A Simple Introduction to the Kalman Filter (This reference from Duy-Ky Nguyen has some excellent examples and very readable derivations.)
- Papers
- David Luenberger's Introduction to Observers
- F.L. Lewis' LQR Explanations
- F.L. Lewis Linear Quadratic Regulator Derivation and Examples
- F.L. Lewis Discrete LQR Derivation and Examples This goes nicely with the above paper doing it for continuous time.
- Jake Abbott's lecture on the Linear Quadratic Regulator
- Greg Welch & Gary Bishop's Introduction to Kalman Filters
- Maria Isabel Ribeiro paper on Kalman Filters
- The Descriptor State Space Model
- Relation Between Continuous Differential Equations and Discrete Difference Equations
- 2016
MATLAB/Octave/Scilab
Gnu Octave
Gnu Octave is a free open source clone of MATLAB. I use it all the time in lieu of MATLAB, and it works well on my Ubuntu Linux OS.
- Octave Control Systems Toolbox This is not the same thing that is on Octave Forge here.
- Digital Control Octave Scripts
MATLAB/Simulink
- This page shows some neat experiments you can do with the ArduinoIO package which allows you to use an Arduino from Simulink/MATLAB. You can also control an Arduino from any terminal program. It's license from Mathworks forbids its use with other software like Octave or Scilab, and probably from controlling an Arduino from your own program, unless it is for use with Mathworks software.
Scilab/Xcos
Scilab is a MATLAB like program. It isn't as compatible with MATLAB as octave is, but it has Xcos, which is a GUI block manipulation tool very similar to Scilab.
- The Xcos ATOM toolbox is very similar to ArduinoIO, but for the open source Scilab/Xcos environment. It works only on Windows at this time, but looking at the source leads me to believe that it would be easy to port it to Linux or OS X and it is fully open source.
Pendulum Specific Scripts
Single Pendulum
% Double Pendulum Parameters (Tentative: There are two pendulum setups, each with different parameters. I'm not sure which these go to.) % This script is for balancing only the long rod. % Run parameters %f = input('Control Frequency (Hz) = '); %Trun = input('Run Time (s) = '); %f=130; f=1000; Trun=30; kmax = round(f*Trun); T = 1/f; Maxpos = 0.25; % Max carriage travel +- 0.25 m Maxangle = 0.175; % Max rod angle -- 10 deg Maxvoltage = 20; % Max motor voltage, V pstart = 0.005; % Carriage position starting limit, m astart = 1*pi/180; % Angle starting limit, rad g = 9.81; % m/s^2 Gravitational constant % SYSTEM PARAMETERS % Measured Mechanical Parameters d1 = 0.323; % m Length of pendulum 1 (long) d2 = 0.079; % m Length of pendulum 2 (short) %mp1 = 0.0208; % kg Mass of pendulum 1 mp1 = 0.0318; %mp2 = 0.0050; % kg Mass of pendulum 2 mp2 = 0.0085; %m=.5; m = 0.3163; % kg Mass of carriage rd = 0.0254/2; % m Drive pulley radius md = 0.0375; % kg Mass of drive pulley (cylinder) %mc1 = 0.0036; % kg Mass of clamp 1* %mc2 = 0.0036; % kg Mass of clamp 2* mc1 = 0.0085; mc2 = mc1; % *Clamp Dimensions % Rectangular 0.0254 x 0.01143 m % The pivot shaft is 0.00714 m from the end % Motor Parameters (Data Sheet) Im = 43e-7; % kg m^2/rad Rotor moment of inertia R = 4.09; % ohms Resistance kt = 0.0351; % Nm/A Torque constant ke = 0.0351; % Vs/rad Back emf constant % Derived Mechanical Parameters % kg m^2/rad Moment of inertia, clamp 1 %Ic1 = mc1*(0.01143^2 + 0.0254^2)/12 + mc1*(0.0127-0.00714)^2; Ic1 = mc1*(0.0098^2 + 0.0379^2)/12; Ic2 = Ic1; % kg m^2/rad Moment of inertia, clamp 2 Id = md*(rd^2)/2; % kg m^2/rad Moment of inertia, drive pulley Imd = Im + Id; % kg m^2/rad Moment of inertia, combined J1 = Ic1 + mp1*(d1^2)/3; % Total moment of inertia, pendulum 1 (long) J2 = Ic2 + mp2*(d2^2)/3; % Total moment of inertia, pendulum 2 (short) Jd = Im + Id; % Total moment of inertia, motor drive Mc = m + mc1 + mc2; % Total carriage mass % Friction Test Data % Carriage Slope = 19 deg; Terminal Velocity xdotss = 0.312 m/s; From % twincarriage.m; formula b = m g sin(theta)/xdotss % Pendulum 1 (long) Exponent a1 = 0.0756 1/s; From longfit.m % Pendulum 2 (short) Exponent a2 = 0.2922 1/s; From shortfit.m % formula b = 2 a J %alpha = 19; alpha = 12.2; %xdotss = 0.312; xdotss = 0.4852; %a1 = 0.0756; %a2 = 0.2922; a1 = 0.0185; a2 = 0.012; % Ns/m Viscous friction of carriage system b = (Mc + mp1 + mp2)*g*sin(alpha*pi/180)/xdotss; b1 = 2*a1*J1; % Nms/rad Viscous friction of pendulum 1 (rotational) b2 = 2*a2*J2; % Nms/rad Viscous friction of pendulum 2 (rotational) scale = [rd*2*pi/4096 2*pi/4096 -0.05/250]; T = 1/f; % The data above comes from the fweb wiki. M=Mc; %mass of cart m=mp1; %mass of pendulum 1 b=b; %friction l=d1/2; %length of pendulum I=J1; %inertia of pendulum %q=(M+m)*(l+m*l^2)-(m*l)^2; %num=[m*l,0]; %numerator for transfer function %den=[q,b*(l+m*l^2),-m*g*l*(M+m),-b*m*g*l]; %denominator for transfer function %[A,B,C,D]=tf2ss(num,den) %A,B,C,D matricies for the state space model % x_vec is [x, x_dot, theta, theta_dot]' % See the web site: https://www.library.cmu.edu/ctms/ctms/examples/pend/invpen.htm A=[ 0 1 0 0; 0 ((-(I+m*l^2)*b)/(I*(M+m)+M*m*l^2)) ((m^2*g*l^2)/(I*(M+m)+M*m*l^2)) 0; 0 0 0 1; 0 ((-m*l*b)/(I*(M+m)+M*m*l^2)) ((m*g*l*(M+m))/(I*(M+m)+M*m*l^2)) 0]; B=[ 0; ((I+m*l^2)/(I*(M+m)+M*m*l^2)); 0; ((m*l)/(I*(M+m)+M*m*l^2))]; C=[ 1 0 0 0; 0 0 1 0]; D=[ 0; 0]; cont_sys = ss(A,B,C,D) rank_ctrb = rank(ctrb(A,B)) original_poles = eig(A) %poles for our system
These Pendulum Parameters and control scripts are for our hardware.
Z Transforms
- Relationship between the Laplace and Z transforms
- Convolution and Z Transforms
- Z Transforms and Convolution
- Here is an animation of convolution with continuous signals. Look at it so you understand what is happening with the mechanics of convolution. To convolve with , you flip shift into on the axis, then you multiply it by to get , then you integrate with respect to , so that the convolution is: . The first animation shows this happening with sampled waveforms: and .
- Notice that this is really the same as Polynomial Multiplication.
Discretization
- This is how the c2d zero order hold works in MATLAB/octave. It uses the "exact" solution to the discretization problem.
- Also check Chapter 7.3 of Greg Starr's book.