Exercise 1a: Transfer functions Transfer functions are a model form based on the Laplace transform. Transfer functions are very useful in analysis and design of linear dynamic systems. A general Transfer function is on the form: Where y is the output and u is the input. H S = y(s) u(s) A general transfer function can be written on the following general form: H s = numerator(s) denominator(s) = b!s! + b!!! s!!! + + b! s + b! a! s! + a!!! s!!! + + a! s + a! The Numerators of transfer function models describe the locations of the zeros of the system, while the Denominators of transfer function models describe the locations of the poles of the system. Differential Equations While the transfer function gives an external in- out representation of a system, will the differential equations of a system give an internal representation of a system. We can find the transfer function from the differential equation by using Laplace and Laplace transformation pairs. Likewise, we can find the differential equation from the transfer function using inverse Laplace. The following transformation pair is much used: Differentiation: 1.order systems: For higher order systems: Integration: x sx(s) x (!) s! x(s) Faculty of Technology, Postboks 203, Kjølnes ring 56, N-3901 Porsgrunn, Norway. Tel: +47 35 57 50 00 Fax: +47 35 57 54 01
2 x 1 s x(s) Time- delay: u t τ u(s)e!!" Static Time- response In some cases we want to find the constant value y! of the time response when the time t. We can then use the final value theorem ( sluttverditeoremet ): y! = lim!! y t = lim!! s y(s) MathScript MathScript has several functions for creating transfer functions: Function Description Example tf Creates system model in transfer function form. You also can >num=[1]; >den=[1, 1, 1]; use this function to state- space models to transfer function >H = tf(num, den) form. Sys_order1 Sys_order2 step Example: Constructs the components of a first- order system model based on a gain, time constant, and delay that you specify. You can use this function to create either a state- space model or a transfer function model, depending on the output parameters you specify. Constructs the components of a second- order system model based on a damping ratio and natural frequency you specify. You can use this function to create either a state- space model or a transfer function model, depending on the output parameters you specify. Creates a step response plot of the system model. You also can use this function to return the step response of the model outputs. If the model is in state- space form, you also can use this function to return the step response of the model states. This function assumes the initial model states are zero. If you do not specify an output, this function creates a plot. In MathScript we will use the following code: % Define Transfer function num = [1]; den = [1, 1]; H s = 1 s + 1 >K = 1; >tau = 1; >H = sys_order1(k, tau) >dr = 0.5 >wn = 20 >[num, den] = sys_order2(wn, dr) >SysTF = tf(num, den) >num=[1,1]; >den=[1,-1,3]; >H=tf(num,den); >t=[0:0.01:10]; >step(h,t);
3 H = tf(num, den) % Step Response step(h) This gives the following step response: A general transfer function can be written on the following general form: H s = numerator(s) denominator(s) = b!s! + b!!! s!!! + + b! s + b! a! s! + a!!! s!!! + + a! s + a! The Numerators of transfer function models describe the locations of the zeros of the system, while the Denominators of transfer function models describe the locations of the poles of the system. In MathScript we can define such a transfer function using the built- in tf function as follows: num = [bm, bm_1, bm_2,, b1, b0]; den = [an, an_1, an_2,, a1, a0]; H = tf(num, den) Task 1: Differential equations to Transfer functions Task 1.1 Given the following differential equation: x = 0.5x + 2u Find the following transfer function:
4 H s = x(s) u(s) Task 1.2 Given the following 2.order differential equation: Find the following transfer function: y + y + 5y = 5x H s = y(s) x(s) Task 2: Transfer functions to differential equatons Task 2.1 H s = x(s) u(s) = 3 0.5s + 1 Find the differential equation from the transfer function above. Task 2.2 Draw a block diagram of the system. Task 3: 2.order system Task 3.1 Find the differential equation for the system. H s = y(s) u(s) = 2s + 3 s! + 4s + 3 Task 4: Static Time- response Task 4.1 H(s) = y(s) u(s) = 3 2s + 1
5 Find the static time- response. We will use a step for the control signal (u t = 1). Note! The Laplace Transformation pair for a step is as follows: Task 4.2 Find the static time- response. 1 s 1 H(s) = y(s) 6(s + 1) = u(s) 9s + 0.25 We will use a step for the control signal (u t = 1). Task 5: 1.order transfer functions Task 5.1 H(s) = y(s) u(s) = 2 4s + 1 What are the values for the gain K and the time constant T for this system? Sketch the step response for the system using pen and paper. Find the step response using MathScript and compare the result with your sketch. Task 5.2 Find the differential equation from the transfer function above and draw a block diagram of the system ( pen and paper ). Task 5.3 From the block diagram in Task 1.2, find the transfer function H(s) =!(!) (The answer shall of course be H(s) =!(!)!(!) =!!!!! ) Task 5.4 Find the solution for the differential equation (y(t)) and plot it ( pen and paper ).!(!)
6 We will use a step for the control signal (u t = 1). Note! The Laplace Transformation pair for a step is as follows: 1 s 1 Tip! You also need to use the following Laplace transform pair: Compare to the results from Task 1.1. K Ts + 1 s K(1 e!!/! ) Task 6: Transfer functions in MathScript Define the following transfer functions in MathScript. Task 6.1 Task 6.2 Task 6.3 H(s) = 2s! + 3s + 4 5s + 9 H(s) = 4s! + 3s + 4 5s! + 9 7 + 3s + 2s! H(s) = 5s + 6s! Task 7: Differential equations to Transfer functions Task 7.1 Given the following differential equation: x = 0.5x + 2u Find the following transfer function:
7 H s = x(s) u(s) Task 8: PI Controller A PI controller is defined as: u(t) = K! e + K! T!! edτ! Where u is the controller output and e is the control error: Task 8.1 Find the transfer function for the PI Controller: Additional Resources e t = r t y(t) H! s = u(s) e(s) http://home.hit.no/~hansha/?lab=mathscript Here you will find tutorials, additional exercises, etc.