Introduction to Scilab
application to feedback control
Yassine Ariba
Brno University of Technology - April 2015
- Y. Ariba - Icam, Toulouse.
Brno University of Technology - April 2015 1 / 142
Introduction to Scilab application to feedback control Yassine - - PowerPoint PPT Presentation
Introduction to Scilab application to feedback control Yassine Ariba Brno University of Technology - April 2015 Y. Ariba - Icam, Toulouse. Brno University of Technology - April 2015 1 / 142 Sommaire 1 What is Scilab ? 4 Application to
Brno University of Technology - April 2015 1 / 142
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 2 / 142
What is Scilab ?
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 3 / 142
What is Scilab ? Introduction
www.scilab.org
Brno University of Technology - April 2015 4 / 142
What is Scilab ? Introduction
More informations : www.scilab.org
Brno University of Technology - April 2015 5 / 142
What is Scilab ? Introduction
R
1.
Brno University of Technology - April 2015 6 / 142
What is Scilab ? Introduction
Brno University of Technology - April 2015 7 / 142
What is Scilab ? Introduction
Brno University of Technology - April 2015 8 / 142
What is Scilab ? Introduction
Brno University of Technology - April 2015 8 / 142
What is Scilab ? Introduction
x = 1.75
Brno University of Technology - April 2015 9 / 142
What is Scilab ? Introduction
Brno University of Technology - April 2015 10 / 142
What is Scilab ? Basics
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 11 / 142
What is Scilab ? Basics
ans = 0.4
ans = 8.
ans =
ans =
ans = 1.
ans = 148.41316
ans = 1.4142136
Brno University of Technology - April 2015 12 / 142
What is Scilab ? Basics
ans =
ans = 4.
Brno University of Technology - April 2015 13 / 142
What is Scilab ? Basics
ans = F
ans = T
ans = T
Brno University of Technology - April 2015 14 / 142
What is Scilab ? Basics
c = 7.5
!--error 4 Undefined variable : d
Brno University of Technology - April 2015 15 / 142
What is Scilab ? Basics
ans = 1.
ans =
Brno University of Technology - April 2015 16 / 142
What is Scilab ? Matrices
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 17 / 142
What is Scilab ? Matrices
u = 0. 1. 2. 3.
v = 0. 0.2 0.4 0.6 0.8 1.
ans = 1. 0.980 0.921 0.825 0.696 0.540
Brno University of Technology - April 2015 18 / 142
What is Scilab ? Matrices
u = 1. 2. 3.
ans = 6.
ans = 0.5
Brno University of Technology - April 2015 19 / 142
What is Scilab ? Matrices
A = 1. 2. 3. 4. 5. 6. 7. 8. 9.
Brno University of Technology - April 2015 20 / 142
What is Scilab ? Matrices
ans = 6.
ans = 4. 5. 6.
ans = 1. 3. 4. 6. 7. 9.
A = 1. 2. 3. 4. 5. 0. 7. 8. 9.
Brno University of Technology - April 2015 21 / 142
What is Scilab ? Matrices
ans = 2.
ans = 1. 0.
0.5
ans = 1. 2. 3. 0. 5. 6. 0. 0. 9.
Brno University of Technology - April 2015 22 / 142
What is Scilab ? Matrices
ans = 2. 1. 6. 2.
ans = 1. 0. 0. 1.
ans = 7. 8. 19. 17. 31. 26.
!--error 8 Inconsistent addition.
Brno University of Technology - April 2015 23 / 142
What is Scilab ? Matrices
ans = 0. 1.
1.225D -16
ans = 1. 1.2214 1.4918 1.8221 2.2255 2.7182
Brno University of Technology - April 2015 24 / 142
What is Scilab ? Matrices
ans = 20.
11.
ans = 0. 8. 5.
ans = 0. 16. 1. 4.
ans = 1. 1.0178 1.0655 1.1388 1.2364 1.3591
Brno University of Technology - April 2015 25 / 142
What is Scilab ? Plotting
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 26 / 142
What is Scilab ? Plotting
Brno University of Technology - April 2015 27 / 142
What is Scilab ? Plotting
Brno University of Technology - April 2015 27 / 142
What is Scilab ? Plotting
Brno University of Technology - April 2015 28 / 142
What is Scilab ? Plotting
Brno University of Technology - April 2015 28 / 142
What is Scilab ? Plotting
Brno University of Technology - April 2015 29 / 142
What is Scilab ? Plotting
Brno University of Technology - April 2015 29 / 142
What is Scilab ? Plotting
Z = cos(X).* sin(Y);
Brno University of Technology - April 2015 30 / 142
What is Scilab ? Plotting
Z = cos(X).* sin(Y);
Brno University of Technology - April 2015 30 / 142
What is Scilab ? Plotting
Brno University of Technology - April 2015 31 / 142
What is Scilab ? Plotting
Brno University of Technology - April 2015 32 / 142
What is Scilab ? Plotting
Brno University of Technology - April 2015 32 / 142
What is Scilab ? Programming
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 33 / 142
What is Scilab ? Programming
Brno University of Technology - April 2015 34 / 142
What is Scilab ? Programming
Brno University of Technology - April 2015 34 / 142
What is Scilab ? Programming
// radius
r = 2; // calculation
area A = 4* %pi*r^2; // calculation
volume V = 4* %pi*r^3/3; disp(A,’Area:’); disp(V,’Volume:’);
Area: 50.265482 Volume: 33.510322
Brno University of Technology - April 2015 35 / 142
What is Scilab ? Programming
Brno University of Technology - April 2015 36 / 142
What is Scilab ? Programming
x1 =
x = linspace(x1 ,x2 ,n); y = exp (-2*x).* sin (3*x); plot(x,y); disp(’seeplotonthefigure ’);
see plot on the figure
Brno University of Technology - April 2015 37 / 142
What is Scilab ? Programming
Brno University of Technology - April 2015 38 / 142
What is Scilab ? Programming
if (x >=0) then disp("xispositive"); else disp("xisnegative"); end
Brno University of Technology - April 2015 39 / 142
What is Scilab ? Programming
select i case 1 disp("One"); case 2 disp("Two"); case 3 disp("Three"); else disp("Other"); end
Brno University of Technology - April 2015 40 / 142
What is Scilab ? Programming
n = 10; for k = 1:n y(k) = exp(k); end
Brno University of Technology - April 2015 41 / 142
What is Scilab ? Programming
x = 16; while ( x > 1 ) x = x/2; end
Brno University of Technology - April 2015 42 / 142
What is Scilab ? Programming
tic S = 0; for k = 1:1000 S = S + k; end t = toc (); disp(t); tic N = [1:1000]; S = sum(N); t = toc (); disp(t);
0.029 0.002
Brno University of Technology - April 2015 43 / 142
What is Scilab ? Programming
y = 0.9738476
N = 11.
Brno University of Technology - April 2015 44 / 142
What is Scilab ? Programming
Brno University of Technology - April 2015 45 / 142
What is Scilab ? Programming
function [x1 ,x2] = roots_equ2d (a,b,c) // roots of ax^2 + bx + c = 0 delta = b^2 - 4*a*c x1 = (-b - sqrt(delta ))/(2*a) x2 = (-b + sqrt(delta ))/(2*a) endfunction
r2 =
r1 =
Brno University of Technology - April 2015 46 / 142
What is Scilab ? Programming
function y = f(x) y = (x+1).* exp (-2*x); endfunction
y = 0.0016773
y = 0.0235828
Brno University of Technology - April 2015 47 / 142
What is Scilab ? Programming
function z=mytest(x) z = x + a; a = a +1; endfunction
ans = 5.
a = 2.
Brno University of Technology - April 2015 48 / 142
For MATLAB users
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 49 / 142
For MATLAB users MATLAB vs Scilab
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 50 / 142
For MATLAB users MATLAB vs Scilab
http://help.scilab.org/docs/5.4.1/en_US/section_36184e52ee88ad558380be4e92d3de21.html
http://help.scilab.org/docs/5.4.1/en_US/About_M2SCI_tools.html
Eike Rietsch, An Introduction to Scilab from a Matlab User’s Point of View, May 2010 http://www.scilab.org/en/resources/documentation/community
Brno University of Technology - April 2015 51 / 142
For MATLAB users MATLAB vs Scilab
In MATLAB search with keywords lookfor comments % predefined constants i, pi, inf, true special characters in name of variables continuation of a statement ... flow control switch case otherwise last element of a vector x(end) In Scilab search with keywords apropos comments // predefined constants %i, %pi, %inf, %t special characters in name of variables , #, !, ?, $ continuation of a statement .. flow control select case else last element of a vector x($)
Brno University of Technology - April 2015 52 / 142
For MATLAB users MATLAB vs Scilab
In MATLAB length, the larger of the number of rows and columns after a first plot, a second one clears the current figure division by a vector >> x = 1/[1 2 3] Error using / Matrix dimensions must agree.
>> [1 2 3] == 1 ans = 1 0 0 >> [1 2 3] == [1 2] Error using == Matrix dimensions must agree. >> [1 2] == [’1’,’2’] ans = 0 0 In Scilab length, the product of the number of rows and columns after a first plot, a second one holds the previous division by a vector
x = 0.0714286 0.1428571 0.2142857 x is solution of [1 2 3]*x = 1
ans = T F F
ans = F
ans = F
Brno University of Technology - April 2015 53 / 142
For MATLAB users MATLAB vs Scilab
In MATLAB for a matrix A=[1 2 4;4 8 2;6 0 9] >> max(A) ans = 7 8 9 >> sum(A) ans = 12 10 18 disp must have a single argument >> a=3; >> disp([’the result is ’,int2str(a),’ ...bye!’]) the result is 3 ...bye! In Scilab for a matrix A=[1 2 4;4 8 2;6 0 9]
ans = 9.
ans = 36. disp may have several arguments
string(a),’hello!’) hello! the result is 3 3. note that : prettyprint generates the Latex code to represent a Scilab
Brno University of Technology - April 2015 54 / 142
For MATLAB users MATLAB vs Scilab
In MATLAB
In Scilab
Brno University of Technology - April 2015 55 / 142
For MATLAB users MATLAB vs Scilab
// a simple script: myscript a = 1 b = a+3; disp(’resultis’+string(b))
Brno University of Technology - April 2015 56 / 142
For MATLAB users MATLAB vs Scilab
a = 1. result is 4
result is 4
script: myscript
a = 1.
result is 4
Brno University of Technology - April 2015 57 / 142
For MATLAB users MATLAB vs Scilab
In MATLAB
In Scilab
Brno University of Technology - April 2015 58 / 142
For MATLAB users MATLAB vs Scilab
y = u1 + u2;
ans = 5.
!--error 4 Variable non d´ efinie : addition
ans = 5.
Brno University of Technology - April 2015 59 / 142
For MATLAB users Exercices
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 60 / 142
For MATLAB users Exercices
Brno University of Technology - April 2015 61 / 142
For MATLAB users Exercices
Brno University of Technology - April 2015 62 / 142
For MATLAB users Exercices
+∞
Brno University of Technology - April 2015 63 / 142
For MATLAB users Exercices
Brno University of Technology - April 2015 64 / 142
Xcos
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 65 / 142
Xcos Basics
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 66 / 142
Xcos Basics
R
counterpart of Scilab.
Brno University of Technology - April 2015 67 / 142
Xcos Basics
R
counterpart of Scilab.
Brno University of Technology - April 2015 67 / 142
Xcos Basics
Brno University of Technology - April 2015 68 / 142
Xcos Basics
block sub-palette sinus Sources/GENSIN f gain
scope Sinks/CSCOPE clock Sources/CLOCK c
Brno University of Technology - April 2015 68 / 142
Xcos Basics
Brno University of Technology - April 2015 69 / 142
Xcos Basics
Brno University of Technology - April 2015 70 / 142
Xcos Basics
Brno University of Technology - April 2015 70 / 142
Xcos Basics
block sub-palette sum
gain
integral
scope Sinks/CSCOPE x-y scope Sinks/CSCOPXY clock Sources/CLOCK c
Brno University of Technology - April 2015 71 / 142
Xcos Basics
Brno University of Technology - April 2015 72 / 142
Xcos Basics
Brno University of Technology - April 2015 73 / 142
Xcos Basics
Brno University of Technology - April 2015 73 / 142
Xcos Basics
Brno University of Technology - April 2015 74 / 142
Xcos Basics
Brno University of Technology - April 2015 74 / 142
Xcos Physical modeling
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 75 / 142
Xcos Physical modeling
Brno University of Technology - April 2015 76 / 142
Xcos Physical modeling
Brno University of Technology - April 2015 76 / 142
Xcos Physical modeling
Brno University of Technology - April 2015 77 / 142
Xcos Physical modeling
Brno University of Technology - April 2015 78 / 142
Xcos Physical modeling
Brno University of Technology - April 2015 78 / 142
Xcos Exercices
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 79 / 142
Xcos Exercices
Brno University of Technology - April 2015 80 / 142
Xcos Exercices
Exercice 2 Let us consider the predator-prey model based on Lotka-Volterra equations ˙ x(t) = x(t)
y(t) = y(t)
x(t) is the number of prey y(t) is the number of predator a and d are parameters describing the growth of the prey population and the predator population b and c are parameters describing the death rate of the prey population and the predator population Simulate 2 the evolution of populations with initial conditions x(0) = 4 and y(0) = 2.
Brno University of Technology - April 2015 81 / 142
Application to feedback control
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 82 / 142
Application to feedback control A brief review
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 83 / 142
Application to feedback control A brief review
Brno University of Technology - April 2015 84 / 142
Application to feedback control A brief review
Brno University of Technology - April 2015 85 / 142
Application to feedback control A brief review
Brno University of Technology - April 2015 85 / 142
Application to feedback control A brief review
Brno University of Technology - April 2015 86 / 142
Application to feedback control A brief review
0.5 1 1.5 2 2.5 3 0.5 1 1.5 2 2.5 Step Response Time (sec) Amplitude
Brno University of Technology - April 2015 86 / 142
Application to feedback control A brief review
10
−1
10 10
1
−40 −20 20 Gain (dB) 10
−1
10 10
1
−180 −135 −90 −45 Phase (degre)
pulsation ω
Brno University of Technology - April 2015 87 / 142
Application to feedback control A brief review
Brno University of Technology - April 2015 88 / 142
Application to feedback control A brief review
Brno University of Technology - April 2015 88 / 142
Application to feedback control A brief review
2 2 4 6 8 10 12 0.5 1 1.5 2 2.5 Step Response Time (sec) Amplitude k=1 k=2 k=5 k=0.5
Brno University of Technology - April 2015 89 / 142
Application to feedback control A brief review
s→0 s ˆ
s )
Brno University of Technology - April 2015 90 / 142
Application to feedback control A brief review
s→0 s ˆ
s )
n
n
3 ζωn = 6s.
Brno University of Technology - April 2015 90 / 142
Application to feedback control System analysis in Scilab
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 91 / 142
Application to feedback control System analysis in Scilab
G = 1
s + s
ans =
Brno University of Technology - April 2015 92 / 142
Application to feedback control System analysis in Scilab
Brno University of Technology - April 2015 93 / 142
Application to feedback control System analysis in Scilab
+
+
Brno University of Technology - April 2015 94 / 142
Application to feedback control System analysis in Scilab
// series connection ans = 4
2s + s
// parallel connection ans = 8 + 5s
2s + s
// feedback connection ans = s
4 + 2s + s
Brno University of Technology - April 2015 95 / 142
Application to feedback control System analysis in Scilab
F = 2
2 + s + s
ans = 1. 2. 1. 0. 2. 0.
zeta = 0.3535534 0.3535534 wn = 1.4142136 1.4142136
Brno University of Technology - April 2015 96 / 142
Application to feedback control Bode plot
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 97 / 142
Application to feedback control Bode plot
Brno University of Technology - April 2015 98 / 142
Application to feedback control Bode plot
Brno University of Technology - April 2015 98 / 142
Application to feedback control Bode plot
1 1.5 2 2.5 3 3.5 4 4.5 5 −1 −0.5 0.5 1 temps (s) e(t) v(t)
Brno University of Technology - April 2015 99 / 142
Application to feedback control Bode plot
10 15 20 25 30 35 40 45 −1 −0.5 0.5 1
temps (s)
e(t) (ω=0.8) v(t)
Brno University of Technology - April 2015 100 / 142
Application to feedback control Bode plot
10 15 20 25 30 35 40 45 −1 −0.5 0.5 1
temps (s)
e(t) (ω=0.8) v(t) 2 3 4 5 6 7 8 9 10 −1 −0.5 0.5 1
temps (s)
e(t) (ω=4) v(t)
Brno University of Technology - April 2015 100 / 142
Application to feedback control Bode plot
10 15 20 25 30 35 40 45 −1 −0.5 0.5 1
temps (s)
e(t) (ω=0.8) v(t) 2 3 4 5 6 7 8 9 10 −1 −0.5 0.5 1
temps (s)
e(t) (ω=4) v(t) 3 3.5 4 4.5 5 5.5 6 6.5 7 −1 −0.5 0.5 1
temps (s)
e(t) (ω=8) v(t)
Brno University of Technology - April 2015 100 / 142
Application to feedback control Bode plot
10 15 20 25 30 35 40 45 −1 −0.5 0.5 1
temps (s)
e(t) (ω=0.8) v(t) 2 3 4 5 6 7 8 9 10 −1 −0.5 0.5 1
temps (s)
e(t) (ω=4) v(t) 3 3.5 4 4.5 5 5.5 6 6.5 7 −1 −0.5 0.5 1
temps (s)
e(t) (ω=8) v(t) 10 10.1 10.2 10.3 10.4 10.5 10.6 10.7 10.8 −1 −0.5 0.5 1 e(t) (ω=40) v(t)
Brno University of Technology - April 2015 100 / 142
Application to feedback control Bode plot
−30 −25 −20 −15 −10 −5 5
Magnitude (dB)
10
−1
10 10
1
10
2
−90 −45
Phase (deg) Bode Diagram Frequency (rad/sec)
Brno University of Technology - April 2015 101 / 142
Application to feedback control Bode plot
−30 −25 −20 −15 −10 −5 5
Magnitude (dB)
10
−1
10 10
1
10
2
−90 −45
Phase (deg) Bode Diagram Frequency (rad/sec)
ω = 8
Brno University of Technology - April 2015 101 / 142
Application to feedback control Bode plot
−25 −20 −15 −10 −5 5
Magnitude (dB)
10
−1
10 10
1
10
2
−90 −45
Phase (deg) Bode Diagram Frequency (rad/sec)
Brno University of Technology - April 2015 102 / 142
Application to feedback control Bode plot
Frequency analysis consists in studying the response of a LTI system with sine inputs
Y(s) U(s)
u(t) = u0 sin(ωt) u(t) = u0 sin(ωt) y(t) = y0 sin(ωt+φ) y(t) = y0 sin(ωt+φ)
Brno University of Technology - April 2015 103 / 142
Application to feedback control Bode plot
Frequency analysis consists in studying the response of a LTI system with sine inputs
Y(s) U(s)
u(t) = u0 sin(ωt) u(t) = u0 sin(ωt) y(t) = y0 sin(ωt+φ) y(t) = y0 sin(ωt+φ)
2 4 6 8 10 12 14 16 18 20 −1 −0.5 0.5 1 1.5
T T ∆ t
The output signal is also a sine with the same frequency, but with a different magnitude and a different phase angle.
Brno University of Technology - April 2015 103 / 142
Application to feedback control Bode plot
Brno University of Technology - April 2015 104 / 142
Application to feedback control Bode plot
Brno University of Technology - April 2015 104 / 142
Application to feedback control Bode plot
Brno University of Technology - April 2015 105 / 142
Application to feedback control Bode plot
we express F(jω) = 1/2 jω + 1 for ω = 0.05 rad/s : |F(j0.05)| = 0.5 and arg F(j0.05) = −2.86◦. for ω = 1.5 rad/s : |F(j1.5)| = 0.277 and arg F(j1.5) = −56.3◦. for ω = 10 rad/s : |F(j10)| = 0.05 and arg F(j10) = −84.3◦.
Brno University of Technology - April 2015 105 / 142
Application to feedback control Bode plot
50 100 150 200 250 300 350 400 450 500 −1 −0.5 0.5 1
u1(t) y1(t)
2 4 6 8 10 12 14 16 −1 −0.5 0.5 1
u2(t) y2(t)
0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 −1 −0.5 0.5 1
u3(t) y3(t)
Brno University of Technology - April 2015 106 / 142
Application to feedback control Bode plot
Bode diagram : it plots the gain and the phase shift w.r.t. the frequency ω the gain is expressed as decibels : gain dB = 20 log y0
u0
property : the Bode diagram of F(s)G(s) is the sum of the one of F(s) and the one of G(s). in Scilab, the instruction bode(F) plots the Bode diagram of F(s).
Brno University of Technology - April 2015 107 / 142
Application to feedback control Bode plot
Bode diagram : it plots the gain and the phase shift w.r.t. the frequency ω the gain is expressed as decibels : gain dB = 20 log y0
u0
property : the Bode diagram of F(s)G(s) is the sum of the one of F(s) and the one of G(s). in Scilab, the instruction bode(F) plots the Bode diagram of F(s).
Brno University of Technology - April 2015 107 / 142
Application to feedback control Simulation with Xcos
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 108 / 142
Application to feedback control Simulation with Xcos
Brno University of Technology - April 2015 109 / 142
Application to feedback control Simulation with Xcos
block sub-palette step Sources/STEP FUNCTION sum
gain
transfert function
scope Sinks/CSCOPE clock Sources/CLOCK c
Brno University of Technology - April 2015 109 / 142
Application to feedback control Exercices
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 110 / 142
Application to feedback control Exercices
Brno University of Technology - April 2015 111 / 142
Classical control design
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 112 / 142
Classical control design
Brno University of Technology - April 2015 113 / 142
Classical control design Loopshaping
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 114 / 142
Classical control design Loopshaping
Brno University of Technology - April 2015 115 / 142
Classical control design Loopshaping
Brno University of Technology - April 2015 116 / 142
Classical control design Loopshaping
Brno University of Technology - April 2015 117 / 142
Classical control design Loopshaping
Brno University of Technology - April 2015 118 / 142
Classical control design Loopshaping
Brno University of Technology - April 2015 119 / 142
Classical control design Loopshaping
Brno University of Technology - April 2015 119 / 142
Classical control design Loopshaping
Brno University of Technology - April 2015 120 / 142
Classical control design Phase lag controller
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 121 / 142
Classical control design Phase lag controller
Brno University of Technology - April 2015 122 / 142
Classical control design Phase lag controller
Brno University of Technology - April 2015 122 / 142
Classical control design Phase lag controller
Brno University of Technology - April 2015 123 / 142
Classical control design Phase lag controller
3k = 0.1
Brno University of Technology - April 2015 123 / 142
Classical control design Phase lag controller
−80 −60 −40 −20 20
Magnitude (dB)
10
−2
10
−1
10 10
1
10
2
−180 −135 −90 −45
Phase (deg) Bode Diagram Frequency (rad/s)
Brno University of Technology - April 2015 124 / 142
Classical control design Phase lag controller
10
−2
10
−1
10 10
1
10
2
−180 −135 −90 −45
Phase (deg) Bode Diagram Frequency (rad/s)
−80 −60 −40 −20 20
Magnitude (dB)
Brno University of Technology - April 2015 124 / 142
Classical control design Phase lag controller
Brno University of Technology - April 2015 125 / 142
Classical control design Phase lag controller
Brno University of Technology - April 2015 125 / 142
Classical control design Phase lag controller 10
−2
10
−1
10 10
1
10
2
−180 −135 −90 −45
Phase (deg) Bode Diagram Frequency (rad/s)
−80 −60 −40 −20 20
Magnitude (dB)
Brno University of Technology - April 2015 126 / 142
Classical control design Phase lag controller −80 −60 −40 −20 20
Magnitude (dB)
10
−3
10
−2
10
−1
10 10
1
10
2
−180 −135 −90 −45
Phase (deg) Bode Diagram Frequency (rad/s)
G(s) kG(s) kC(s)G(s)
Brno University of Technology - April 2015 126 / 142
Classical control design Phase lag controller
Brno University of Technology - April 2015 127 / 142
Classical control design Phase lag controller
1 2 3 4 5 6 0.2 0.4 0.6 0.8 1 1.2 1.4
Step Response Time (seconds) Amplitude
Brno University of Technology - April 2015 127 / 142
Classical control design Phase lead controller
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 128 / 142
Classical control design Phase lead controller
Brno University of Technology - April 2015 129 / 142
Classical control design Phase lead controller
Brno University of Technology - April 2015 129 / 142
Classical control design Phase lead controller
Brno University of Technology - April 2015 130 / 142
Classical control design Phase lead controller
Brno University of Technology - April 2015 131 / 142
Classical control design Phase lead controller
5 10 15 20 25 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
Step Response Time (seconds) Amplitude
−40 −20 20 40 60
Magnitude (dB)
10
−2
10
−1
10 10
1
−180 −135 −90
Phase (deg) Bode Diagram Frequency (rad/s)
Brno University of Technology - April 2015 131 / 142
Classical control design Phase lead controller
Brno University of Technology - April 2015 132 / 142
Classical control design Phase lead controller
Brno University of Technology - April 2015 132 / 142
Classical control design Phase lead controller
5 10 15 20 25 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
Step Response Time (seconds) Amplitude
−40 −20 20 40 60
Magnitude (dB)
10
−2
10
−1
10 10
1
−180 −135 −90
Phase (deg) Bode Diagram Frequency (rad/s)
Brno University of Technology - April 2015 133 / 142
Classical control design Phase lead controller
5 10 15 20 25 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
Step Response Time (seconds) Amplitude
−100 −50 50 100
Magnitude (dB)
10
−2
10
−1
10 10
1
10
2
−180 −135 −90
Phase (deg) Bode Diagram Frequency (rad/s)
Brno University of Technology - April 2015 133 / 142
Classical control design PID controller
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 134 / 142
Classical control design PID controller
s + kds
1 τis)(1 + τds)
Brno University of Technology - April 2015 135 / 142
Classical control design PID controller
Brno University of Technology - April 2015 136 / 142
Classical control design PID controller
Brno University of Technology - April 2015 137 / 142
Classical control design PID controller
Brno University of Technology - April 2015 138 / 142
Classical control design PID controller
Brno University of Technology - April 2015 139 / 142
Classical control design Exercices
1 What is Scilab ?
2 For MATLAB users
3 Xcos
4 Application to feedback control
5 Classical control design
Brno University of Technology - April 2015 140 / 142
Classical control design Exercices
Brno University of Technology - April 2015 141 / 142
Classical control design Exercices
Brno University of Technology - April 2015 142 / 142