Sie sind auf Seite 1von 38

Frequency Response

Hans-Petter Halvorsen, M.Sc.


Spesialtilfelle Reguleringsteknikk
Laplace 1.orden
Tilstandsrom- Differensial Transfer-
K = Forsterkning
modeller -likninger funksjoner T=Tidskonstant

Blokk- 1.orden med tidsforsinkelse


diagrammer Sprang-
Tidsplanet S-planet respons
Serie, Parallel, Feedback

2.orden
Dataverktøy
Analyse/Design
Stabilitets-
MathScript Det komplekse plan
analyse 2. Frekvensrespons
LabVIEW 1. Systemets poler Bodediagram
Det komplekse plan
Realisering/
Implementering
Diskretisering
Reguleringssystem
Asymptotisk stabilt system

Air Heater Marginalt stabilt system


Tidsplanet
Asymptotisk stabilt system
Ustabilt system Marginalt stabilt system
Ustabilt system
Table of Contents

1. What is Frequency Response?


2. Bode Diagram
3. Frequency Response in MathScript
1. Using built-in functions
2. Create from “scratch”
Frequency Response

What is Frequency Why do we need


Response? Frequency Response?

Vizualization Analysis and Design of


Control Systems

Bode Diagram
Stability Analysis

MathScript Check if the system is


stable or not
Introduction
to
Frequency Response
Frequency Response Example
Outside Temperature
frequency 1 (year)

T = 1 year

-> Only the gain and


frequency 2 (24 hours) phase are different

T = 24 hours

Inside Temperature
frequency 1 (year)
Assume the outdoor temperature is
varying like a sine function during a year
(frequency 1) or during 24 hours
(frequency 2).
frequency 2 (24 hours)
Then the indoor temperature will be a
sine as well, but with different gain. In
addition it will have a phase lag.
Frequency Response Example
Air Heater

Imput Signal Output Signal

Dynamic
System

Amplitude Frequency
Gain Phase Lag
(“forsterkning”) (“faseforskyvning”)

The frequency response of a system expresses how a sinusoidal signal of a given frequency on
the system input is transferred through the system.
Frequency Response - Definition

and the same for Frequency 3, 4, 5, 6, etc.

• The frequency response of a system is defined as the steady-state response


of the system to a sinusoidal input signal.
• When the system is in steady-state, it differs from the input signal only in
amplitude/gain (A) (“forsterkning”) and phase lag (ϕ) (“faseforskyvning”).
Frequency Response from Input-Output Signals

t
The phase lag is given by:
The gain is given by:
(“faseforskyvning”)
(“forsterkning”)
Exercise

Students:
Pen and paper: Find the gain (A) and the phase lag (ϕ) for this example
Solutions
From the Plot we get:

Cont. next page ->


Solutions
(“forsterkning”)

(“faseforskyvning”)
Bode Diagram
Bode Diagram
You can find the Bode diagram from experiments on the physical prosess or from the
transfer function (the model of the system).
A simple sketch of the Bode diagram for a given system:

𝜔𝑐
𝐿𝑜𝑔 𝜔 ω [rad/s]
∆𝐾

𝜑 𝜔180
𝐿𝑜𝑔 𝜔 ω [rad/s]

 The Bode diagram gives a simple Graphical overview of the Frequency Response for a given system.
A Tool for Analyzing the Stability properties of the Control System
Find Data Bode Diagram
We find A and ϕ for each of the frequencies,
e.g.:

The same for frequency 3, 4, …, n

Based on that we can plot the Frequency Response in a so-called Bode Diagram:

Cont. next page->


Bode Diagram The x-scale is logarithmic

Gain (“Forsterkningen”)
The y-scale is in [dB]

Phase lag (“Faseforkyvningen”)


The y-scale is in [degrees]

Vanligvis er enheten for frekvens Hertz [Hz], men i


frekvensrespons/Bodediagram brukes radianer ω [rad/s]. Sammenhengen
Using MathScript to calculate and
plot the Frequency Response in a
Bode Diagram
Bode Diagram – MathScript Example
Given the following transfer function:

% We define the transfer function:


We will use MathScript to find the K = 1;
Frequency Response/Bode Diagram: T = 1;
num = [K];
den = [T, 1];
H = tf(num, den)

% We plot the Bode diagram:


bode(H);

% We add grid to the plot:


subplot(2,1,1)
grid on
subplot(2,1,2)
grid on

Students: Implement this example in MathScript Cont. on bext page->


Bode Diagram – MathScript Example cont.
Given the following transfer function:

Instead of Plotting the Bode Diagram we can also use the bode function for
calculation and showing the data as well:
...
wlist = [0.01, 0.1, 1, 2 ,3 ,5 ,10,
100];[mag, phase, w] = bode(H, wlist);
magdB = 20*log10(mag); % Convert to dB
freq_data = [w, magdB, phase]

MathScript gives the following results:

Students: Try this code also


Bode Diagram – MathScript Example cont.

w A(w) [dB] ϕ(w) [deg.]

We see that the Calculated Data and the


Bode Diagram gives the same values
Bode Diagram – MathScript Example

Given the following transfer function:

Students: Plot the Bode Diagram for the given transfer function using MathScript
Bode Diagram – MathScript Example - Solutions
or:

clear, clc

% Transfer function
num=[1];
den1=[1,0];
den2=[1,1]
den3=[1,1]
den = conv(den1,conv(den2,den3));
H = tf(num, den)

% Bode Diagram
bode(H) clear, clc
subplot(2,1,1) % Transfer function
grid on num=[1];
den=[1,2,1,0];
subplot(2,1,2) H = tf(num, den)
grid on
% Bode Diagram
bode(H)
or: subplot(2,1,1)
grid on
subplot(2,1,2)
grid on
How-To Manually find the
Frequency Response from the
Transfer Function
Frequency Response from the Transfer function
A and ϕ is a function of the frequency ω so we may write A = A(ω), ϕ = ϕ(ω)
We want to manually find mathematical expressions for A(ω) and ϕ(ω) (assuming the
bode function does not exist, actually, this is how the bode function does it.)

s=jω

Where H(jω) is the frequency response of the system, i.e., we may find the frequency
response by setting s=jω in the transfer function. This mean we have to deal with complex
numbers!

The Gain function is defined as:


Length (“Gain”) Length

Angle
The Phase function is defined as:
Angle (“Phase”)
Complex Numbers
Rectangular form of a complex number Exponential/polar form of a complex number

Length (“Gain”):

Angle (“Phase”):
Mathematical expressions
for A(ω) and ϕ(ω)
We find the Mathematical expressions for A(ω) and ϕ(ω) by setting s=jω in the transfer function

cont. next page ->


<- cont. from previous page

 Disse funksjonene kan vi enkelt implementere i MathScript eller andre programmeringsspråk


Mathematical expressions
for A(ω) and ϕ(ω) - Example

Given the following transfer function:

Students: Find the Mathematical expressions for A(ω) and ϕ(ω) (Pen & Paper)
Mathematical expressions
for A(ω) and ϕ(ω) - Solutions
We find the Mathematical expressions for A(ω) and ϕ(ω) by setting s=jω in the transfer function

Gain: [dB]

Phase: [rad]
MathScript functions needed:
• atan
Students: Implement these equations in MathScript and find • log10
the Frequency Response for different frequencies, i.e find • sqrt
values for A(ω) and ϕ(ω) for different frequencies (e.g, • pi
w=0.01, 0.1, 1, 2, 5 ,10, 100). Plot the Frequency Response as • subplot
well based on the calculated values for A(ω) and ϕ(ω). • semilogx
MathScript Solutions
Method 1:
We find A(ω) and ϕ(ω) for w=0.01, 0.1, 1, 2, 5 ,10, 100, etc.
w=1;

gain = 20*log10(1) - 20*log10(sqrt(w^2+1))


phase = -atan(w) * 180/pi

We find the values for A and ϕ for different


Method 2 (recommended): frequencies and write them manually into a
table
We find A(ω) and ϕ(ω) for w=0.01, 0.1, 1, 2, 5 ,10, 100, etc.
using a For Loop
w = [0.01, 0.1, 1, 10, 100];
N = length(w);

for i=1:N
gain(i) = 20*log10(1) - 20*log10(sqrt(w(i)^2+1));
phase(i) = -atan(w(i)) * 180/pi;
end %Gain Plot
subplot(2,1,1)
semilogx(w, gain), grid
%Phase Plot
Plotting: subplot(2,1,2)
semilogx(w, phasedeg), grid
MathScript Solutions
The bode function is used
directly on the transfer function
H(s)

The mathematical expressions for


A(ω) and ϕ(ω) are used together
with the subplot and semilogx
functions
Conclusion: We get the same results (of
course).
If we had plotted more frequencies, the
results would be even closer.
More Examples…
Mathematical expressions
for A(ω) and ϕ(ω)
We find the Mathematical expressions for A(ω) and ϕ(ω) by setting s=jω in the transfer function

cont. next page ->


Complex Numbers
Given 2 Complex Numbers:

and

Multiplikasjon:

Divisjon:
<- cont. from previous page
Mathematical expressions for A(ω) and ϕ(ω) - Example

Students: Find the Mathematical expressions for A(ω) and ϕ(ω) for the different
transfer functions below using pen and paper
Mathematical expressions for A(ω) and ϕ(ω) - Examples
Solutions: Students: Implment them in MathScript and plot the Bode
diagram. Compare with the built-in bode function.
Hans-Petter Halvorsen, M.Sc.
Telemark University College
Faculty of Technology
Department of Electrical Engineering, Information Technology and Cybernetics

E-mail: hans.p.halvorsen@hit.no
Blog: http://home.hit.no/~hansha/

38

Das könnte Ihnen auch gefallen