CSL03

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

LABORATORY MANUAL BM-351L| BIOMEDICAL CONTROL SYSTEM BM-024-2020S

LAB # 03
To display a Transfer Function from given zeros, poles, gain from a given Transfer
Function using MATLAB.

TRANSFER FUNCTION: Transfer functions are a frequency-domain representation of linear time-invariant


systems. For instance, consider a continuous-time SISO dynamic system represented by the transfer function
sys(s) = N(s)/D(s), where s = jw and N(s) and D(s) are called the numerator and denominator polynomials,
respectively. The tf model object can represent SISO or MIMO transfer functions in continuous time or
discrete time.

A SISO continuous-time transfer function is expressed as the ratio: G(s)= N(s) / D (s) of polynomials N(s)
and D(s), called the numerator and denominator polynomials, respectively.

You can represent linear systems as transfer functions in polynomial or factorized (zero-pole-gain) form.
Use tf to create real-valued or complex-valued transfer function models, or to convert dynamic system
models to transfer function form. The tf model object represents transfer functions in polynomial form.

ZEROS-POLES GAIN: Zero-pole-gain models are a representation of transfer functions in factorized form.
A more general representation of the SISO zero-pole-gain model is as follows:

Here, z and p are the vectors of real-valued or complex-valued zeros and poles, and K is the real-valued or
complex-valued scalar gain

You can create a zero-pole-gain model object either by specifying the poles, zeros and gains directly, or by
converting a model of another type (such as a state-space model ss) to zero-pole-gain form. You can also use
zpk to create generalized state-space (genss) models.

Syntax: sys = zpk(zeros,poles,gain) creates a continuous-time zero-pole-gain model with zeros and poles
specified as vectors and the scalar value of gain. The output sys is a zpk model object storing the model data.
Set zeros or poles to [ ] for systems without zeros or poles. These two inputs need not have equal length and
the model need not be proper (that is, have an excess of poles).

OTHER MATLAB COMMANDS:


 zp2tf: zp2tf forms transfer function polynomials from the zeros, poles, and gains of a system in factored
form.
[b,a] = zp2tf(z,p,k) finds a rational transfer function
LABORATORY MANUAL BM-351L| BIOMEDICAL CONTROL SYSTEM BM-024-2020S

given a system in factored transfer function form

Column vector p specifies the pole locations, and matrix z specifies the zero locations, with as many
columns as there are outputs. The gains for each numerator transfer function are in vector k. The zeros
and poles must be real or come in complex conjugate pairs. The polynomial denominator coefficients are
returned in row vector a and the polynomial numerator coefficients are returned in matrix b, which has
as many rows as there are columns of z.
 tf2zp: tf2zpk finds the zeros, poles, and gains of a discrete-time transfer function.
[z,p,k] = tf2zpk(b,a) finds the matrix of zeros z, the vector of poles p, and the associated vector of
gains k from the transfer function parameters b and a:
 The numerator polynomials are represented as columns of the matrix b.
 The denominator polynomial is represented in the vector a.

PROCEDURE
1. Open a new editor window in MATLAB.
2. Write the MATLAB code.
3. Make sure to enter the poles, zeros, gain, coefficients of numerator and denominator in square brackets
on the command window while entering as inputs.
4. Save the file with a label that has no spaces and no special characters before running it.
5. After the program is run, find out the answers theoretically and compare them to the MATLAB results.

TASK# 01: Write MATLAB code to obtain the transfer function of a system from its pole, zeros and
values. Assume poles are at -3.2 ± 7.8j, -4.1±5.9j and -8, while zero at -0.8 ±0.43j and -0.6, and gain ois
0.5.

SOURCE CODE
z = input('Enter Zeros')
p = input('Enter Poles')
k = input('Enter Gain')
[num, den] = zp2tf(z,p,k)
tf(num,den)

OUTPUT:
LABORATORY MANUAL BM-351L| BIOMEDICAL CONTROL SYSTEM BM-024-2020S

TASK# 02: Write a MATLAB code to obtain the transfer function of a system from its pole, zeros and
values. Assume poles are at -2, and 1, while zero is at -1, and gain is 7.

SOURCE CODE
p = [-2 1]
z = [-1]
k = 7
[num,den]=zp2tf(z',p',k)
g = tf(num,den)

OUTPUT:
LABORATORY MANUAL BM-351L| BIOMEDICAL CONTROL SYSTEM BM-024-2020S

TASK# 03: Write a MATLAB code to obtain the transfer function of a system from its pole, zeros and
gain values. A) Assume poles are at -1 ± j and -4, while zero are at -2, -5 and gain is 1. B) Assume poles
are at -1 ±4j and -5 while zeros are at -8, -5, and gain is 0.75.

(A) SOURCE CODE


p = [-1+j -1-j -4]
z = [-2 -5]
k = 1
[num,den]=zp2tf(z',p',k)
g = tf(num,den)

OUTPUT:

(B) SOURCE CODE


z = input('Enter Zeros')
p = input('Enter Poles')
k = input('Enter Gain')
[num, den] = zp2tf(z,p,k)
tf(num,den)

OUTPUT
LABORATORY MANUAL BM-351L| BIOMEDICAL CONTROL SYSTEM BM-024-2020S
TASK# 04: Obtain the poles, zeros and gain of the transfer functions given below
C(s) / R(s) = (s2 + 4s +3) / (s3 + 3s2 + 7s + 5)
SOURCE CODE
num = input('Enter the numerator of the transfer function')
den = input('Enter the denominator of the transfer function')
[z,p,k] = tf2zp(num,den)

OUTPUT:

TASK# 05: Obtain the poles, zeros and gain of the transfer functions given below

C(s) / R(s) = (s2 + 4s +3) / (s + 5) (s2 + 4s + 7)

SOURCE CODE
num = [1 4 3]
den = conv([1 5],[1 4 7])
g = tf(num,den)
[z,p,k] = tf2zp(num,den)
pzmap(g)

OUTPUT:

Pole-Zero Map
2

1.5

1
Imaginary Axis (seconds -1)

0.5

-0.5

-1

-1.5

-2
-6 -5 -4 -3 -2 -1 0
Real Axis (seconds -1)
LABORATORY MANUAL BM-351L| BIOMEDICAL CONTROL SYSTEM BM-024-2020S
SELF TASKS:
TASK # 02:
TASK # 01:
SOURCE CODE
SOURCE CODE num = [5];
den = [1 0 9];
num = [1]; g = tf(num,den)
den = [1 1 4]; [z,p,k] = tf2zp(num,den)
g = tf(num,den)
[z,p,k] = tf2zp(num,den)
OUTPUT:
OUTPUT:

TASK 3:
SOURCE CODE
num = [1];
d = conv([1 3 5],[1 3]);
den = conv(d,[1 5]);
g = tf(num,den)
[z,p,k] = tf2zp(num,den)

CONCLUSION:
A transfer function is a convenient way to represent a
linear, time-invariant system in terms of its input-
output relationship. It is obtained by applying a
Laplace transform to the differential equations
describing system dynamics, assuming zero initial
conditions.
LABORATORY MANUAL BM-351L| BIOMEDICAL CONTROL SYSTEM BM-024-2020S
In the absence of these equations, a transfer function can also be estimated from measured input-output data.

Transfer functions are frequently used in block diagram representations of systems and are popular for
performing time-domain and frequency-domain analyses and controller design. The key advantage of
transfer functions is that they allow engineers to use simple algebraic equations instead of complex
differential equations for analyzing and designing systems.

--------------------------------------

You might also like