#include <control.h> int main() { array double complex zero[3]={complex(-0.05, 2.738156), complex(-0.05, -2.738156), -2.0}, pole[4]={ complex(-1.797086, 2.213723), complex(-1.797086, -2.213723), complex(-0.262914, 2.703862), complex(-0.262914, -2.703862)}; double k1=4; class CControl sys1; sys1.model("zpk", zero, pole, k1); printf("\nThe system is created with ZPK model\n"); printf("System matrices obtained by printss() member function.\n"); sys1.printss(); printf("\n\n"); int nx, ny, nu; nx = sys1.size('x'); // obtain the number of states of the system ny = sys1.size('y'); // obtain the number of outputs of the system nu = sys1.size('u'); // obtain the number of inputs of the system array double A1[nx][nx], B1[nx][nu], C1[ny][nx], D1[ny][nu]; sys1.ssdata(A1, B1, C1, D1); printf("System matrices obtained by ssdata() member function.\n"); printf("A = \n%f\nB = \n%f\nC = \n%f\nD = \n%f\n", A1, B1, C1, D1); printf("Transfer function parameters obtained by printtf() member function.\n"); sys1.printtf(); printf("\n\n"); int nnum1, nden1; nnum1 = sys1.size('n'); nden1 = sys1.size('d'); array double num1[nnum1], den1[nden1]; sys1.tfdata(num1, den1); printf("Transfer function parameters obtained by tfdata() member function.\n"); printf("num1 = %f\nden1 = %f\n", num1, den1); return 0; }