SSC-session2 - Lola y Laura PDF

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

SIMULATION SESSION 2

SIGNALS, SYSTEMS AND CIRCUITS


BACHELOR IN ENGINEERING PHYSICS
2nd Course, 2nd Semester
2021-2022 Academic Course

Team
Full Name 1 Lola Aguilera Villegas
Full Name 2 Laura Navarro González

DEPARTAMENTO DE TECNOLOGÍA ELECTRÓNICA


Campus de Leganés
Avenida del Universidad 30
28911 Leganés
SSC/GIF/SS2/21_22

1 Introduction
The target of this session is to learn the tools to describe and model LTI systems in Matlab.
Firstly, we will learn the description of transfer functions, and the computation of impulse, step
and frequency response. Secondly, we will learn how to perform transient behavioral
simulations.

Control Toolbox and Simulink are required for this session.

2 Generating LTI objects in Matlab


Linear and Time Invariant systems can be numerically modelled in Matlab using a data structure.
The format of the data structure depends on the external representation we are interested in.
It is also possible to use an internal representation. We will focus on two external
representations:

- Transfer function as a ratio of polynomial functions (tf)


- Transfer function as a set of gain, zeros and poles (zpk)

Try and report the following commands.


Hs1=tf([1 2],[1 2 1])
Hz1=tf(1,[1 2 1],1)

Hs1 =

s + 2
-------------
s^2 + 2 s + 1

Continuous-time transfer function.

Hz1 =

1
-------------
z^2 + 2 z + 1

Sample time: 1 seconds


Discrete-time transfer function.

Compute the .zpk representation of Hs1 and Hz1, and report zeros, poles and gain. Is the gain
reported the static gain?

2021/22 Course 2
SSC/GIF/SS2/21_22

>> Hs1_zpk=zpk(Hs1)

Hs1_zpk =

(s+2)
-------
(s+1)^2

Continuous-time zero/pole/gain model.

>> Hz1_zpk=zpk(Hz1)

Hz1_zpk =

1
-------
(z+1)^2

Sample time: 1 seconds


Discrete-time zero/pole/gain model.

- Zeros:

>> Hs1_zpk.z{:}, Hz1_zpk.z{:}

ans =

-2

ans =

0×1 empty double column vector

- Poles:

>> Hs1_zpk.p{:}, Hz1_zpk.p{:}

ans =

-1
-1

ans =

-1
-1

2021/22 Course 3
SSC/GIF/SS2/21_22

- Gain:

>> Hs1_zpk.k, Hz1_zpk.k

ans =

ans =

The static gains of both transfer functions are calculated as H(s=0) for CT and H(z=1)
for DT; leading to the values:
1
𝐻𝑠1(0)  =  2  ≠  1      𝐻𝑧1(1)  =     ≠  1
4
Therefore, as we can see, the values obtained with MATLAB do not match with the
theoretical ones.

3 Analysis of Continuous-Time systems


Describe the following transfer functions
1
𝐻1 (𝑠) =
𝑠2 + 2𝑠 + 10
2𝑠 + 1
𝐻2 (𝑠) =
𝑠2 + 2𝑠 + 10
Use ‘roots’ command to compute poles and zeros, or use zpk representation
Hs1 = tf([1],[1,2,10])
Hs2 = tf([2,1],[1,2,10])

>> Hs1_zpk=zpk(Hs1)

Hs1_zpk =

1
---------------
(s^2 + 2s + 10)

Continuous-time zero/pole/gain model.

2021/22 Course 4
SSC/GIF/SS2/21_22

>> Hs2_zpk=zpk(Hs2)

Hs2_zpk =

2 (s+0.5)
---------------
(s^2 + 2s + 10)

Continuous-time zero/pole/gain model.

- Zeros:

>> Hs1_zpk.z{:}, Hs2_zpk.z{:}

ans =

0×1 empty double column vector

ans =

-0.5000

- Poles:

>> Hs1_zpk.p{:}, Hs2_zpk.p{:}

ans =

-1.0000 + 3.0000i
-1.0000 - 3.0000i

ans =

-1.0000 + 3.0000i
-1.0000 - 3.0000i

Use ‘step’ to compute the step response. Report peak time and overshoot for each system. What
is the effect of adding a zero to the system?

2021/22 Course 5
SSC/GIF/SS2/21_22

Step Response

𝑃𝑒𝑎𝑘  =  0.135 
𝑂𝑣𝑒𝑟𝑠ℎ𝑜𝑜𝑡  =  𝑃𝑒𝑎𝑘 − 𝑘  =  0.135 − 0.1  =  0.035 

𝑃𝑒𝑎𝑘  =  0.481 
𝑂𝑣𝑒𝑟𝑠ℎ𝑜𝑜𝑡  =  𝑃𝑒𝑎𝑘 − 𝑘  =  0.481 − 0.1  =  0.381 

As it can be seen, adding a zero to the system means that the step response is faster
(decreases the rise time and the peak time) and that the overshoot increases.

2021/22 Course 6
SSC/GIF/SS2/21_22

Plot the frequency response of both systems with ‘bode’ command and comment the impact of
having complex poles. What is the influence of adding a real zero in this case?

2021/22 Course 7
SSC/GIF/SS2/21_22

The impact (in the bode plots) of having complex poles are the slopes obtained, which
differ from the ones that we obtain when we have real poles and zeros (first order CT
systems).
The addition of a zero in this case change the bode plot slightly by having a “peak” or
“distortion” when comparing with the one with no zeros.

4 Transient simulation of Continuous-Time systems

If we want to predict the transient response of the system to an arbitrary input, we need to
numerically solve the differential equations of the external representation. Although there are
commands in Matlab to perform this task, we prefer to use a graphical tool called Simulink.

Type ‘Simulink’ in the command window and create a new blank model. Create the following
block diagram, and set the following Model Settings:

2021/22 Course 8
SSC/GIF/SS2/21_22

Run the simulation and open the scope to check the result. Can you check if the obtained value
corresponds to the predicted value in the bode plot? Please comment here.

2021/22 Course 9
SSC/GIF/SS2/21_22

Looking at the Bode plot of Hs1, we can see that the frequency of 𝜋 is around –15.7.

Therefore, the amplitude of our signal becomes approximately:


16
( )
𝐴𝑚𝑝𝑙𝑖𝑡𝑢𝑑𝑒  →  10 20 = 0.1585 ,
what is what we have obtained in our output signal.

Change the input to a square wave. Check ‘Sources’ library. Set the square wave to have an
amplitude of 1 (between 0 and 1) and a period of 2 seconds. Run the system and check the
output. Copy the output waveform here. What is the amplitude? And the frequency? Can you
explain the waveform using the frequency response and the spectrum of the square wave?
Add your comments here.

2021/22 Course 10
SSC/GIF/SS2/21_22

It is known that a CT periodic signal (finite power) can be decomposed in a


superposition of (infinite) harmonically related complex exponentials (Fourier series).
Moreover, the output that we have obtained can be understood as the sum of the
filtered harmonics.
Looking at the spectrum and the frequency response, we can say that approximately,
the result expected has been achieved.

Now try to run the following system and check BIBO stability. Can you explain the results?

(hint: compute the poles of the whole transfer function)

2021/22 Course 11
SSC/GIF/SS2/21_22

1 1 1
𝑠 + 2 ·𝑠+4·𝑠+6
𝐻(𝑠)  =  
1 1 1
1 + 500 · 𝑠 + 2 · 𝑠 + 4 · 𝑠 + 6
1
(𝑠 + 2)(𝑠 + 4)(𝑠 + 6) 1
𝐻(𝑠) = =
(𝑠 + 2)(𝑠 + 4)(𝑠 + 6) + 500 (𝑠 + 2)(𝑠 + 4)(𝑠 + 6) + 500
(𝑠 + 2)(𝑠 + 4)(𝑠 + 6)
1
= 3
𝑠 + 12𝑠 2 + 44𝑠 + 548

Therefore, there is a simple pole: 𝑠  ≈   − 12.10497 …

There is BIBO stability if the output is bounded as well as the input is. That happens if
the real part of the poles obtained is negative.

𝐵𝐼𝐵𝑂 𝑆𝑡𝑎𝑏𝑖𝑙𝑖𝑡𝑦  →  𝑅𝑒(𝑝𝑗 ) ≤ 0

Thus, as –12.10497 < 0, we can affirm that there is BIBO stability.

2021/22 Course 12

You might also like