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

  1.  
  2. // This routine tests the continuous dlqr solution methods using examples
  3. // from Laub's paper.
  4.  
  5. rfile banner
  6. rfile daremsf
  7.  
  8. banner("Discrete lqr QA");
  9. // =============================================
  10. //                     Test 1:
  11. // =============================================
  12.  
  13. printf("%s"," \n");
  14. banner("Test1");
  15. printf("%s"," \n");
  16.  
  17. A=[0.9512,0;0,0.9048];
  18. B=[4.877,4.877;-1.1895,3.569];
  19. R=[(1/3),0;0,3];
  20. Q=[0.005,0;0,0.02];
  21.  
  22. // Exact Solution
  23. Xsolution=[0.010459082320970,0.003224644477419;
  24.            0.003224644477419,0.050397741135643];
  25.  
  26. // RLaB dlqr routine solution
  27. X=daremsf(A,B,Q,R);
  28.  
  29. // Check norm of the error
  30. Xnorm=norm(Xsolution-X.p);
  31. printf("%s","Norm of solution error = ");
  32. sprintf(sdum,"%12.5e",Xnorm);
  33. s="   "+sdum;
  34. printf("%s\n",s);
  35.