#include <control.h> #define NUMX 4 // number of states #define NUMU 1 // number of inputs #define NUMY 1 // number of outputs int main() { array double A[NUMX][NUMX] = { 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, -0.5, 0, 0, 0}; array double B[NUMX][NUMU] = { 0, 1, 0, -1}; array double C[NUMY][NUMX] = { 0, 0, 1, 0}; array double D[1][1] = {0}; array double K[1][NUMX]; array double complex p[NUMX] = {-1, -1, complex(-1,1), complex(-1,-1)}; array double A1[NUMX][NUMX]; array double x0[NUMX] = {0.175, 0, 0, 0}; class CPlot plotinitial, plotstep, plotimpulse; class CControl sys0; class CControl sys; sys0.model("ss", A, B, C, D); sys0.acker(K, p); printf("K = %f\n", K); A1 = A - B*K; sys.model("ss", A1, B, C, D); sys.initial(&plotinitial, NULL, NULL, NULL, x0); sys.step(&plotstep, NULL, NULL, NULL); sys.impulse(&plotimpulse, NULL, NULL, NULL); return 0; }