Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.59 KB | None | 0 0
  1. %------------------------------------- 1. feladat -----------------------------------------------
  2.  
  3. s=tf('s');
  4. display('<<< Continuous-time process: >>>')
  5. P=zpk(1/(1+5*s)/(1+10*s))
  6. Ts=1;
  7. display('<<< Discretized process with Ts=1 sec: >>>')
  8. G=zpk(c2d(P,Ts))
  9. z=tf('z',Ts);
  10. display('<<< Decompose and normalize as G(z)=Gm(z)Gp(z) with Gm(1)=1: >>>')
  11. pause;
  12. display('<<< Gm(z): >>>')
  13. Gm=1
  14. display('<<< Gp(z): >>>')
  15. Gp=G
  16. display('<<< Specify the design polynomial Rr(z)=Rn(z)=1/z: >>>')
  17. pause;
  18. Rr=1/z;
  19. Rn=1/z
  20. display('<<< Calculate the C(z) controller: >>>')
  21. pause;
  22. C=minreal(Rn/Gp/(1-Rn*Gm),0.0001)
  23. display('<<< Find the loop transfer function L(z)=C(z)G(c): >>>')
  24. pause;
  25. L=minreal(C*G,0.0001)
  26. display('<<< Show the transfer function T(z)=Y(z)/Yr(z) : >>>')
  27. pause;
  28. T=minreal(L/(1+L),0.0001)
  29. display('<<< The transfer function form reflects the numerical conditions): >>>')
  30. pause;
  31. T=tf(T)
  32. display('<<< Compare with the theoretical value (Gm/z): >>>')
  33. pause;
  34. tf(Gm/z)
  35. display('<<< Show the servo input-output records: >>>')
  36. pause;
  37. y=step(T,10); t=0:10; subplot(211),plot(t,y,'*'),grid;
  38. u=step(minreal(C/(1+L)),10); subplot(212),stairs(t,u),grid;
  39. pause;
  40. display('<<< Check the disturbance rejecion: >>>')
  41. pause;
  42. S=minreal(1/(1+L))
  43. tf(S)
  44. display('<<< Compare with the theoretical value (1-Rn/Gm): >>>')
  45. pause;
  46. tf(1-Rn*Gm)
  47. display('<<< Show the disturbance rejecion input-output records: >>>')
  48. pause;
  49. y=step(S,10); t=0:10; subplot(211),plot(t,y,'*'),grid;
  50. u=step(minreal(-C/(1+L)),10); subplot(212),stairs(t,u),grid;
  51. display('<<< Check the steady-state properties: >>>')
  52. dcgain(T)
  53. dcgain(S)
  54. pause;
  55. display('<<< Decompose G(z) with Gm=(z+0.9048)/(1+0.9048): >>>')
  56. Gm=(z+0.9048)/(1+0.9048)/z
  57. display('<<< Gp(z): >>>')
  58. Gp=minreal(G/Gm,0.0001)
  59. display('<<< Calculate the C(z) controller: >>>')
  60. pause;
  61. C=minreal(Rn/Gp/(1-Rn*Gm),0.0001)
  62. display('<<< Find the loop transfer function L(z)=C(z)G(c): >>>')
  63. pause;
  64. L=minreal(C*G,0.0001)
  65. display('<<< Show the transfer function T(z)=Y(z)/Yr(z) : >>>')
  66. pause;
  67. T=minreal(L/(1+L),0.0001)
  68. display('<<< The transfer function form reflects the numerical conditions): >>>')
  69. pause;
  70. T=tf(T)
  71. display('<<< Compare with the theoretical value (Gm/z): >>>')
  72. pause;
  73. tf(Gm/z)
  74. display('<<< Show the servo input-output records: >>>')
  75. pause;
  76. y=step(T,10); t=0:10; subplot(211),plot(t,y,'*'),grid;
  77. u=step(minreal(C/(1+L)),10); subplot(212),stairs(t,u),grid;
  78. pause;
  79. display('<<< Check the disturbance rejecion: >>>')
  80. pause;
  81. S=minreal(1/(1+L))
  82. tf(S)
  83. display('<<< Compare with the theoretical value (1-Rn/Gm): >>>')
  84. pause;
  85. tf(1-Rn*Gm)
  86. display('<<< Show the disturbance rejecion input-output records: >>>')
  87. pause;
  88. y=step(S,10); t=0:10; subplot(211),plot(t,y,'*'),grid;
  89. u=step(minreal(-C/(1+L)),10); subplot(212),stairs(t,u),grid;
  90.  
  91.  
  92.  
  93.  
  94. %------------------------------------- 2. feladat -----------------------------------------------
  95. s=tf('s');
  96. display('<<< Continuous-time process: >>>')
  97. P=zpk(1/(1+5*s)/(1+8*s)/(1+10*s))
  98. Ts=1;
  99. display('<<< Discretized process with Ts=1 sec: >>>')
  100. G=zpk(c2d(P,Ts))
  101. z=tf('z',Ts);
  102. display('<<< Decompose and normalize as G(z)=Gm(z)Gp(z) with Gm(1)=(z+3.358)/(1+3.358)/z: >>>')
  103. pause;
  104. display('<<< Gm(z): >>>')
  105. Gm=(z+3.358)/(1+3.358)/z
  106. display('<<< Gp(z): >>>')
  107. Gp=minreal(G/Gm,0.0001)
  108. display('<<< Specify the design polynomial Rn(z)=1/z: >>>')
  109. pause;
  110. Rn=1/z
  111. display('<<< Calculate the C(z) controller: >>>')
  112. pause;
  113. C=minreal(Rn/Gp/(1-Rn*Gm),0.0001)
  114. display('<<< Find the loop transfer function L(z)=C(z)G(c): >>>')
  115. pause;
  116. L=minreal(C*G,0.0001)
  117. display('<<< Show the transfer function T(z)=Y(z)/Yr(z) : >>>')
  118. pause;
  119. T=minreal(L/(1+L),0.0001)
  120. display('<<< The transfer function form reflects the numerical conditions): >>>')
  121. pause;
  122. T=tf(T)
  123. display('<<< Compare with the theoretical value (Gm/z): >>>')
  124. pause;
  125. tf(Gm/z)
  126. display('<<< Show the servo input-output records: >>>')
  127. pause;
  128. y=step(T,10); t=0:10; subplot(211),plot(t,y,'*'),grid;
  129. u=step(minreal(C/(1+L)),10); subplot(212),stairs(t,u),grid;
  130. display('<<< Check the disturbance rejecion: >>>')
  131. pause;
  132. S=minreal(1/(1+L))
  133. tf(S)
  134. display('<<< Compare with the theoretical value (1-Rn/Gm): >>>')
  135. pause;
  136. tf(1-Rn*Gm)
  137. display('<<< Show the disturbance rejecion input-output records: >>>')
  138. pause;
  139. y=step(S,10); t=0:10; subplot(211),plot(t,y,'*'),grid;
  140. u=step(minreal(-C/(1+L)),10); subplot(212),stairs(t,u),grid;
  141. display('<<< Check the steady-state properties: >>>')
  142. dcgain(T)
  143. dcgain(S)
  144. pause;
  145. display('<<< Define new Rn=Rr=0.1/(z-0.9) >>>');
  146. Rn=0.1/(z-0.9)
  147. Rr=0.1/(z-0.9)
  148. display('<<< Calculate the C(z) controller: >>>')
  149. pause;
  150. C=minreal(Rn/Gp/(1-Rn*Gm),0.0001)
  151. display('<<< Find the loop transfer function L(z)=C(z)G(c): >>>')
  152. pause;
  153. L=minreal(C*G,0.0001)
  154. display('<<< Show the transfer function T(z)=Y(z)/Yr(z) : >>>')
  155. pause;
  156. T=minreal(L/(1+L),0.0001)
  157. display('<<< The transfer function form reflects the numerical conditions): >>>')
  158. pause;
  159. T=tf(T)
  160. display('<<< Compare with the theoretical value (Gm/z): >>>')
  161. pause;
  162. tf(Rr*Gm/z)
  163. display('<<< Show the servo input-output records: >>>')
  164. pause;
  165. y=step(T,30); t=0:30; subplot(211),plot(t,y,'*'),grid;
  166. u=step(minreal(C/(1+L)),30); subplot(212),stairs(t,u),grid;
  167. pause;
  168. display('<<< Check the disturbance rejecion: >>>')
  169. pause;
  170. S=minreal(1/(1+L))
  171. tf(S)
  172. display('<<< Compare with the theoretical value (1-Rn/Gm): >>>')
  173. pause;
  174. tf(1-Rn*Gm)
  175. display('<<< Show the disturbance rejecion input-output records: >>>')
  176. pause;
  177. y=step(S,10); t=0:10; subplot(211),plot(t,y,'*'),grid;
  178. u=step(minreal(-C/(1+L)),10); subplot(212),stairs(t,u),grid;
  179. pause;
  180. display('<<< Check the steady-state properties: >>>')
  181. dcgain(Rr*Gm/z)
  182. dcgain(S)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement