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

  1. //-----------------------------------------------------------------------------
  2. // ********************
  3. // * AUGSTATE Testing *
  4. // ********************
  5. //
  6. // Version JBL 950106
  7. //
  8.  
  9. rfile augstate
  10.  
  11. // Ref: MATLAB Control Toolbox Manual
  12. A=[0,1;2,3];
  13. B=[0;1];
  14. C=[1,0];
  15. D=[1];
  16.  
  17. Dum=augstate(A,B,C,D);
  18.  
  19. Aex=A;
  20. Bex=B;
  21. Cex=[1,0;1,0;0,1];
  22. Dex=[1;0;0];
  23.  
  24. // Check results
  25. // Appended A matrix
  26. Enorm=norm(Dum.aa-Aex);
  27. printf ("AUGSTATE: A matrix check (this matrix ought to be ZERO)\n");
  28. Dum.aa-Aex
  29. printf("%s","Norm of difference = ");
  30. sprintf(sdum,"%12.5e",Enorm);
  31. s="   "+sdum;
  32. printf("%s\n",s);
  33.  
  34. // Appended B matrix
  35. Enorm=norm(Dum.ba-Bex);
  36. printf ("AUGSTATE: B matrix check (this matrix ought to be ZERO)\n");
  37. Dum.ba-Bex
  38. printf("%s","Norm of difference = ");
  39. sprintf(sdum,"%12.5e",Enorm);
  40. s="   "+sdum;
  41. printf("%s\n",s);
  42.  
  43. // Appended C matrix
  44. Enorm=norm(Dum.ca-Cex);
  45. printf ("AUGSTATE: C matrix check (this matrix ought to be ZERO)\n");
  46. Dum.ca-Cex
  47. printf("%s","Norm of difference = ");
  48. sprintf(sdum,"%12.5e",Enorm);
  49. s="   "+sdum;
  50. printf("%s\n",s);
  51.  
  52. // Appended D matrix
  53. Enorm=norm(Dum.da-Dex);
  54. printf ("AUGSTATE: D matrix check (this matrix ought to be ZERO)\n");
  55. Dum.da-Dex
  56. printf("%s","Norm of difference = ");
  57. sprintf(sdum,"%12.5e",Enorm);
  58. s="   "+sdum;
  59. printf("%s\n",s);
  60.  
  61.