home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / r / rlab / CTB / ssselectte < prev    next >
Encoding:
Text File  |  1995-11-15  |  2.6 KB  |  124 lines

  1. //-----------------------------------------------------------------------------
  2. // ********************
  3. // * SSSELECT Testing *
  4. // ********************
  5. //
  6. // Version JBL 950106
  7. //
  8.  
  9. // =============================================
  10. //                     Test 1:
  11. // =============================================
  12. printf("%s"," \n");
  13. banner("Test1");
  14. printf("%s"," \n");
  15.  
  16. A=[33,2,5;23,200,2;9,2,45];
  17. B=[4,5;12,5;82,1];
  18. C=[34,56,2;6,2,112];
  19. D=[2,0;0,19];
  20.  
  21. inputs=1;
  22. outputs=1;
  23. // Exact solution
  24. aex=A;
  25. bex=[4;12;82];
  26. cex=[34,56,2];
  27. dex=[2];
  28. AT=ssselect(A,B,C,D,inputs,outputs);
  29.  
  30. // Check the error
  31. printf("%s","selected A matrix check (this matrix should be ZERO)\n");
  32. aex-AT.ae
  33. printf("%s"," \n");
  34.  
  35. printf("%s","selected B matrix check (this matrix should be ZERO)\n");
  36. bex-AT.be
  37. printf("%s"," \n");
  38.  
  39. printf("%s","selected C matrix check (this matrix should be ZERO)\n");
  40. cex-AT.ce
  41. printf("%s"," \n");
  42.  
  43. printf("%s","selected D matrix check (this matrix should be ZERO)\n");
  44. dex-AT.de
  45. printf("%s"," \n");
  46.  
  47. // =============================================
  48. //                     Test 2:
  49. // =============================================
  50. printf("%s"," \n");
  51. banner("Test2");
  52. printf("%s"," \n");
  53.  
  54. A=[33,2,5;23,200,2;9,2,45];
  55. B=[4,5;12,5;82,1];
  56. C=[34,56,2;6,2,112];
  57. D=[2,0;0,19];
  58.  
  59. inputs=1;
  60. outputs=2;
  61. // Exact solution
  62. aex=A;
  63. bex=[5;5;1];
  64. cex=[6,2,112];
  65. dex=[0];
  66. AT=ssselect(A,B,C,D,inputs,outputs);
  67.  
  68. // Check the error
  69. printf("%s","selected A matrix check (this matrix should be ZERO)\n");
  70. aex-AT.ae
  71. printf("%s"," \n");
  72.  
  73. printf("%s","selected B matrix check (this matrix should be ZERO)\n");
  74. bex-AT.be
  75. printf("%s"," \n");
  76.  
  77. printf("%s","selected C matrix check (this matrix should be ZERO)\n");
  78. cex-AT.ce
  79. printf("%s"," \n");
  80.  
  81. printf("%s","selected D matrix check (this matrix should be ZERO)\n");
  82. dex-AT.de
  83. printf("%s"," \n");
  84.  
  85. // =============================================
  86. //                     Test 3:
  87. // =============================================
  88. printf("%s"," \n");
  89. banner("Test3");
  90. printf("%s"," \n");
  91.  
  92. A=[33,2,5;23,200,2;9,2,45];
  93. B=[4,5;12,5;82,1];
  94. C=[34,56,2;6,2,112];
  95. D=[2,0;0,19];
  96.  
  97. inputs=1;
  98. outputs=2;
  99. states=[2,3];
  100. // Exact solution
  101. aex=[200,2;2,45];
  102. bex=[5;1];
  103. cex=[2,112];
  104. dex=[0];
  105. AT=ssselect(A,B,C,D,inputs,outputs,states);
  106.  
  107. // Check the error
  108. printf("%s","selected A matrix check (this matrix should be ZERO)\n");
  109. aex-AT.ae
  110. printf("%s"," \n");
  111.  
  112. printf("%s","selected B matrix check (this matrix should be ZERO)\n");
  113. bex-AT.be
  114. printf("%s"," \n");
  115.  
  116. printf("%s","selected C matrix check (this matrix should be ZERO)\n");
  117. cex-AT.ce
  118. printf("%s"," \n");
  119.  
  120. printf("%s","selected D matrix check (this matrix should be ZERO)\n");
  121. dex-AT.de
  122. printf("%s"," \n");
  123.  
  124.