home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 7.ddi / ROBUST.DI$ / ACCPLT.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  4.1 KB  |  147 lines

  1. %
  2. % ---------------------------------------------------------------
  3. %  ACCPLT.M is a script file that produces the plots for the ACC
  4. %     Benchmark problem.
  5. % ---------------------------------------------------------------
  6. %
  7.  
  8. % R. Y. Chiang & M. G. Safonov 
  9. % Copyright (c) 1988 by the MathWorks, Inc.
  10. % All Rights Reserved.
  11.  
  12. clg
  13. if flag == 2
  14.       subplot(111)
  15.       semilogx(w,[perttw;pertt]);
  16.       title('Cost Function in "s~" and "s"');
  17.       grid;xlabel('Rad/Sec'); ylabel('PERRON SSV (db)');
  18.       msmw = max(perttw);
  19.       msmw = 1/(10^(msmw/20)/gamopt)*100;
  20.       msm  = max(pertt);
  21.       msm  = 1/(10^(msm/20)/gamopt)*100;
  22.       text(0.2,0.3,['ADDITIVE MSM IN s~-DOMAIN: +-',num2str(msmw),' %'],'sc');
  23.       text(0.2,0.2,['ADDITIVE MSM IN s-DOMAIN : +-',num2str(msm),' %'],'sc');
  24.       %prtsc
  25.       pause
  26. end
  27.  
  28. if flag ~= 3
  29.    clg
  30.    subplot(221)
  31.    plot(t,x1_ipw1);grid;
  32.    title('x1');       xlabel('Sec')
  33.    subplot(222)
  34.    plot(t,x2_ipw1);grid;
  35.    title('x2 (z)');   xlabel('Sec');
  36.    subplot(223)
  37.    plot(t,u_ipw1); grid;
  38.    title('Control (u)'); xlabel('Sec');
  39.    subplot(224)
  40.    text(0.6,0.4,'Impulse Response @ M1','sc');
  41.    text(0.6,0.35,'Sensor Noise: 0.001*sin(100t)','sc')
  42. %  if flag == 1
  43.    text(0.65,0.25,'Dashed: k = 0.5','sc');
  44.    text(0.65,0.2,'Solid:  k = 1.0','sc');
  45.    text(0.65,0.15,'Dotted: k = 2.0','sc');
  46. %  end
  47.    %prtsc
  48.    pause
  49.    clg
  50.    subplot(221)
  51.    plot(t,x1_ipw2);grid;
  52.    title('x1');  xlabel('Sec');
  53.    subplot(222)
  54.    plot(t,x2_ipw2);grid
  55.    title('x2 (z)');   xlabel('Sec');
  56.    subplot(223)
  57.    plot(t,u_ipw2); grid;
  58.    title('Control (u)'); xlabel('Sec');
  59.    subplot(224)
  60.    text(0.6,0.4,'Impulse Response @ M2','sc');
  61.    text(0.6,0.35,'Sensor Noise: 0.001*sin(100t)','sc')
  62. %  if flag == 1
  63.    text(0.65,0.25,'Dashed: k = 0.5','sc');
  64.    text(0.65,0.2,'Solid:  k = 1.0','sc');
  65.    text(0.65,0.15,'Dotted: k = 2.0','sc');
  66. %  end
  67.    %prtsc
  68.    pause
  69. else
  70.    clg
  71.    subplot(221)
  72.    plot(t,dist_w);grid
  73.    title('Disturbance: sin(0.5*t) @ M2');
  74.    xlabel('Sec');
  75.    subplot(222)
  76.    plot(t,u_w2);grid;
  77.    title('Control Energy (u)');
  78.    xlabel('Sec'); 
  79.    subplot(223)
  80.    plot(t,x1_w2);grid;
  81.    title('x1'); 
  82.    xlabel('Sensor Noise: 0.001sin(100t)');
  83.    subplot(224)
  84.    plot(t,x2_w2);grid;
  85.    title('x2 (z)');  
  86.    xlabel('Sec (k = 0.5(- -), 1(-), 2(.))');
  87.    %prtsc
  88.    pause
  89.    clg
  90.    subplot(221)
  91.    plot(t,dist_w);grid
  92.    title('Disturbance: sin(0.5*t) @ M1');
  93.    xlabel('Sec');
  94.    subplot(222)
  95.    plot(t,u_w1);grid;
  96.    title('Control Energy (u)');   xlabel('Sec');
  97.    subplot(223)
  98.    plot(t,x1_w1);grid;
  99.    title('x1');   
  100.    xlabel('Sensor Noise: 0.001sin(100t)');
  101.    subplot(224)
  102.    plot(t,x2_w1);grid;
  103.    title('x2 (z)');  
  104.    xlabel('Sec (k = 0.5(- -), 1(-), 2(.))');
  105.    %prtsc
  106.    pause
  107. end  
  108. %
  109. clg
  110. subplot(221)
  111. semilogx(w,gf);title('Controller F(s)');
  112. xlabel('Rad/Sec'); ylabel('Gain (db)')
  113. subplot(223)
  114. semilogx(w,pf);xlabel('Rad/Sec');ylabel('Phase (deg)')
  115. subplot(222)
  116. semilogx(w,gl); title('Loop TF G*F'); xlabel('Rad/Sec');
  117. %if flag == 2
  118. %   text(0.002,-100,['GM: ',num2str(gmin),' db']);
  119. %else
  120.    text(0.002,-50,['Min. GM: ',num2str(gmin),' db']);
  121.    text(0.002,-150,['Max. GM: ',num2str(gmax),' db']);
  122. %end
  123. subplot(224)
  124. semilogx(w,pl);
  125. xlabel('Rad/Sec (k = 0.5(- -), 1(-), 2(.))');ylabel('Phase (deg)')
  126. %if flag == 2
  127. %   text(0.002,min(pl)+100,['PM: ',num2str(pmin),' deg']);
  128. %else
  129.    text(0.002,max(min(pl))+100,['Min. PM: ',num2str(pmin),' deg']);
  130.    text(0.002,max(min(pl)),['Max. PM: ',num2str(pmax),' deg']);
  131. %end 
  132. %prtsc
  133. pause
  134. % plot the root locus
  135. %accroot
  136. %
  137. clc
  138. disp(' ');
  139. disp(' ');
  140. disp('  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *')
  141. disp('  *                                                               *')
  142. disp('  *      Your design is accomplished ..                           *');
  143. disp('  *              Controller: (nuf,dnf).                           *');
  144. disp('  *                                                               *');
  145. disp('  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *')
  146. %
  147. % ----------- End of ACCPLT.M % RYC/MGS %