Advertisement
Guido_Fe

Automatica 2

May 18th, 2017
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.51 KB | None | 0 0
  1. >> help laplace
  2. --- help for sym/laplace ---
  3.  
  4. laplace Laplace transform.
  5. L = laplace(F) is the Laplace transform of the sym F with default
  6. independent variable t. The default return is a function of s.
  7. If F = F(s), then laplace returns a function of z: L = L(z).
  8. By definition, L(s) = int(F(t)*exp(-s*t),t,0,inf).
  9.  
  10. L = laplace(F,z) makes L a function of z instead of the default s:
  11. laplace(F,z) <=> L(z) = int(F(t)*exp(-z*t),t,0,inf).
  12.  
  13. L = laplace(F,w,u) makes L a function of u instead of the
  14. default s (integration with respect to w).
  15. laplace(F,w,u) <=> L(u) = int(F(w)*exp(-u*w),w,0,inf).
  16.  
  17. Examples:
  18. syms a s t w x F(t)
  19. laplace(t^5) returns 120/s^6
  20. laplace(exp(a*s)) returns -1/(a-z)
  21. laplace(sin(w*x),t) returns w/(t^2+w^2)
  22. laplace(cos(x*w),w,t) returns t/(t^2+x^2)
  23. laplace(x^(3/2),t) returns (3*pi^(1/2))/(4*t^(5/2))
  24. laplace(diff(F(t))) returns s*laplace(F(t),t,s) - F(0)
  25.  
  26. See also sym/ilaplace, sym/fourier, sym/ztrans, subs.
  27.  
  28. >> syms s
  29. >> G=(5*s+12)/(s^2+5*s+6)
  30.  
  31. G =
  32.  
  33. (5*s + 12)/(s^2 + 5*s + 6)
  34.  
  35. >> ilaplace(G)
  36.  
  37. ans =
  38.  
  39. 2*exp(-2*t) + 3*exp(-3*t)
  40.  
  41. >> ilaplace(G*1/s)
  42.  
  43. ans =
  44.  
  45. 2 - exp(-3*t) - exp(-2*t)
  46.  
  47. >> G=(5*s+12)/(s^2+5*s)
  48.  
  49. G =
  50.  
  51. (5*s + 12)/(s^2 + 5*s)
  52.  
  53. >> ilaplace(G)
  54.  
  55. ans =
  56.  
  57. (13*exp(-5*t))/5 + 12/5
  58.  
  59. >> help tf
  60. tf Construct transfer function or convert to transfer function.
  61.  
  62. Construction:
  63. SYS = tf(NUM,DEN) creates a continuous-time transfer function SYS with
  64. numerator NUM and denominator DEN. SYS is an object of type tf when
  65. NUM,DEN are numeric arrays, of type GENSS when NUM,DEN depend on tunable
  66. parameters (see REALP and GENMAT), and of type USS when NUM,DEN are
  67. uncertain (requires Robust Control Toolbox).
  68.  
  69. SYS = tf(NUM,DEN,TS) creates a discrete-time transfer function with
  70. sample time TS (set TS=-1 if the sample time is undetermined).
  71.  
  72. S = tf('s') specifies the transfer function H(s) = s (Laplace variable).
  73. Z = tf('z',TS) specifies H(z) = z with sample time TS.
  74. You can then specify transfer functions directly as expressions in S
  75. or Z, for example,
  76. s = tf('s'); H = exp(-s)*(s+1)/(s^2+3*s+1)
  77.  
  78. SYS = tf creates an empty tf object.
  79. SYS = tf(M) specifies a static gain matrix M.
  80.  
  81. You can set additional model properties by using name/value pairs.
  82. For example,
  83. sys = tf(1,[1 2 5],0.1,'Variable','q','IODelay',3)
  84. also sets the variable and transport delay. Type "properties(tf)"
  85. for a complete list of model properties, and type
  86. help tf.<PropertyName>
  87. for help on a particular property. For example, "help tf.Variable"
  88. provides information about the "Variable" property.
  89.  
  90. By default, transfer functions are displayed as functions of 's' or 'z'.
  91. Alternatively, you can use the variable 'p' in continuous time and the
  92. variables 'z^-1', 'q', or 'q^-1' in discrete time by modifying the
  93. "Variable" property.
  94.  
  95. Data format:
  96. For SISO models, NUM and DEN are row vectors listing the numerator
  97. and denominator coefficients in descending powers of s,p,z,q or in
  98. ascending powers of z^-1 (DSP convention). For example,
  99. sys = tf([1 2],[1 0 10])
  100. specifies the transfer function (s+2)/(s^2+10) while
  101. sys = tf([1 2],[1 5 10],0.1,'Variable','z^-1')
  102. specifies (1 + 2 z^-1)/(1 + 5 z^-1 + 10 z^-2).
  103.  
  104. For MIMO models with NY outputs and NU inputs, NUM and DEN are
  105. NY-by-NU cell arrays of row vectors where NUM{i,j} and DEN{i,j}
  106. specify the transfer function from input j to output i. For example,
  107. H = tf( {-5 ; [1 -5 6]} , {[1 -1] ; [1 1 0]})
  108. specifies the two-output, one-input transfer function
  109. [ -5 /(s-1) ]
  110. [ (s^2-5s+6)/(s^2+s) ]
  111.  
  112. Arrays of transfer functions:
  113. You can create arrays of transfer functions by using ND cell arrays
  114. for NUM and DEN above. For example, if NUM and DEN are cell arrays
  115. of size [NY NU 3 4], then
  116. SYS = tf(NUM,DEN)
  117. creates the 3-by-4 array of transfer functions
  118. SYS(:,:,k,m) = tf(NUM(:,:,k,m),DEN(:,:,k,m)), k=1:3, m=1:4.
  119. Each of these transfer functions has NY outputs and NU inputs.
  120.  
  121. To pre-allocate an array of zero transfer functions with NY outputs
  122. and NU inputs, use the syntax
  123. SYS = tf(ZEROS([NY NU k1 k2...])) .
  124.  
  125. Conversion:
  126. SYS = tf(SYS) converts any dynamic system SYS to the transfer function
  127. representation. The resulting SYS is always of class tf.
  128.  
  129. See also tf/exp, filt, tfdata, zpk, ss, frd, genss, USS, DynamicSystem.
  130.  
  131. Reference page for tf
  132. Other functions named tf
  133.  
  134. >> G=tf([5 12], [1 5 6])
  135.  
  136. G =
  137.  
  138. 5 s + 12
  139. -------------
  140. s^2 + 5 s + 6
  141.  
  142. Continuous-time transfer function.
  143.  
  144. >> pzmap(G)
  145. >> s=tf('s')
  146.  
  147. s =
  148.  
  149. s
  150.  
  151. Continuous-time transfer function.
  152.  
  153. >> G=(s+2)*(s-4)/(s+3)/(s+4)/(s+6)
  154.  
  155. G =
  156.  
  157. s^2 - 2 s - 8
  158. ------------------------
  159. s^3 + 13 s^2 + 54 s + 72
  160.  
  161. Continuous-time transfer function.
  162.  
  163. >> syms K
  164. >> G=tf([K],[1 13 54 72])
  165. Error using tf (line 287)
  166. The values of the "num" and "den" properties must be row vectors or cell arrays of row vectors, where each vector is nonempty and containing numeric data. Type "help tf.num"
  167. or "help tf.den" for more information.
  168.  
  169. >> step(G)
  170. >> bode(G)
  171. >> G=(s+2)*(s-4)/(s+3)/(s+4)/(s+6)
  172.  
  173. G =
  174.  
  175. s^2 - 2 s - 8
  176. ------------------------
  177. s^3 + 13 s^2 + 54 s + 72
  178.  
  179. Continuous-time transfer function.
  180.  
  181. >> bode(G)
  182. >> G=(s+2)*(s+4)/(s+3)/(s+4)/(s+6)
  183.  
  184. G =
  185.  
  186. s^2 + 6 s + 8
  187. ------------------------
  188. s^3 + 13 s^2 + 54 s + 72
  189.  
  190. Continuous-time transfer function.
  191.  
  192. >> bode(G)
  193. >> G=(s+2)*(s-4)/(s+3)/(s+4)/(s+6)
  194.  
  195. G =
  196.  
  197. s^2 - 2 s - 8
  198. ------------------------
  199. s^3 + 13 s^2 + 54 s + 72
  200.  
  201. Continuous-time transfer function.
  202.  
  203. >> G1=(s+2)*(s+4)/(s+3)/(s+4)/(s+6)
  204.  
  205. G1 =
  206.  
  207. s^2 + 6 s + 8
  208. ------------------------
  209. s^3 + 13 s^2 + 54 s + 72
  210.  
  211. Continuous-time transfer function.
  212.  
  213. >> plot(G)
  214. Error using plot
  215. Data must be numeric, datetime, duration or an array convertible to double.
  216.  
  217. >> bode(G)
  218. >> hold on
  219. >> bode(G1)
  220. >> G1=100/(s+3)/(s+4)/(s+6)
  221.  
  222. G1 =
  223.  
  224. 100
  225. ------------------------
  226. s^3 + 13 s^2 + 54 s + 72
  227.  
  228. Continuous-time transfer function.
  229.  
  230. >> bode(G1)
  231. >> G1=10*G1
  232.  
  233. G1 =
  234.  
  235. 1000
  236. ------------------------
  237. s^3 + 13 s^2 + 54 s + 72
  238.  
  239. Continuous-time transfer function.
  240.  
  241. >> bode(G1)
  242. >>
  243.  
  244. rlocus
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement