#include <control.h> #define NUMX 4 // number of states #define NUMU 2 // number of inputs #define NUMY 2 // number of outputs int main() { array double A[NUMX][NUMX] = {{0, 1, 0, 0}, {0, 0, 0, 0.0024}, {0, 0, 0, 1}, {0, -0.0024, 0, 0}}; array double B[NUMX][NUMU] = {0, 0, 1, 0, 0, 0, 0, 1}; array double C[NUMY][NUMX] = {1, 0, 0, 0, 0, 0, 1, 0}; array double co[NUMX][NUMX*NUMU]; array double ob[NUMX*NUMY][NUMX]; int num; class CControl sys; sys.model("ss", A, B, C, NULL); sys.ctrb(co); num = rank(co); if(num == NUMX) printf("The system is controllable.\n"); else printf("The system is not controllable.\n"); printf("co = \n%f\n", co); sys.obsv(ob); num = rank(ob); if(num == NUMX) printf("The system is observable.\n"); else printf("The system is not observable.\n"); printf("ob = \n%f\n", ob); return 0; }