Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: ltisys.h
- Revision:
- 1:231f20f755fe
- Parent:
- 0:d144578aa744
- Child:
- 2:ea36561fdc00
--- a/ltisys.h Thu May 07 11:10:40 2015 +0000
+++ b/ltisys.h Fri May 08 17:03:13 2015 +0000
@@ -1,14 +1,47 @@
#ifndef LTISYS_H_
#define LTISYS_H_
+/** ltisys class
+ * Implementation of continuous-time linear time-invariant system by RK4
+ *
+ * @tparam nx number of states
+ * @tparam nu number of inputs
+ * @tparam ny number of outputs
+ */
template<int nx, int nu, int ny>
class ltisys{
public:
+ /** Create ltisys instance
+ * implements
+ * dx/dt = Ax +Bu,
+ * y = Cx + Du
+ * @param matA A-matrix in continuous-time linear state-space representation
+ * @param matB B-matrix in continuous-time linear state-space representation
+ * @param matC C-matrix in continuous-time linear state-space representation
+ * @param matD D-matrix in continuous-time linear state-space representation
+ *
+ * @note All matrices are row major in this library. Different from MATLAB/FORTRAN.
+ */
ltisys(double *matA, double *matB, double *matC, double *matD);
virtual ~ltisys();
+ /** Update states and outputs
+ * updates internal states and outputs of the system
+ * calculation is done by 4th order Runge-Kutta method
+ * @param dt time elapsed from the last update
+ * @param u new input
+ */
inline void update(double dt, double *u);
- double x[nx], u[nu], y[ny];
+
+ /// system states
+ double x[nx];
+
+ /// applied inputs
+ double u[nu];
+
+ /// system outputs
+ double y[ny];
+
double A[nx][nx], B[nx][nu], C[ny][nx], D[ny][nu];
private: