Workshop Matlab/Simulink in Drives and Power Electronics: Lecture 1: Introduction To Matlab
Workshop Matlab/Simulink in Drives and Power Electronics: Lecture 1: Introduction To Matlab
Workshop
Matlab/Simulink in Drives
and Power Electronics
Lecture 1 : Introduction to Matlab
Workshop Program
• 8 lectures will be presented based on Matlab/Simulink :
– 1 Introduction to Matlab
– 2 Introduction to Simulink
– 3 DC-Motor Control design
– 4 DC-Motor Chopper design SimPowerSystems
– 5 Introduction to Stateflow/Statechart
– 6 Induction Motor Inverter Control
– 7 Synchronous Motor Modeling
– 8 Synchronous Motor Control
• Two system applications (four quadrants electric drives of
mechanical systems) will be used as "conducting lines" during
the workshop.
18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 1 2 / 24
Palestine Polytechnic University
18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 1 3 / 24
Palestine Polytechnic University
System applications:
Four quadrants electric drives of mechanical systems
1- ELEVATOR
18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 1 4 / 24
Palestine Polytechnic University
0 .3 F _ R O T 1 .T O R Q U
0 .2
0 .1
-0 .1
-0 .2
-0 .3
-1 5 -1 0 -5 0 5 10 1 5M A S S _ R O T 1 .O
18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 1 5 / 24
Palestine Polytechnic University
2- ARM of ROBOT
18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 1 / 24
Palestine Polytechnic University
18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 1 / 24
Palestine Polytechnic University
Matlab/
Simulink
is a very
good tool
for this kind
of approach.
18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 1 8 / 24
Palestine Polytechnic University
Last version is
R2009a
18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 1 9 / 24
Palestine Polytechnic University
Workspace Figures
Variables
Editor
Command Window
18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 1 10 / 24
Palestine Polytechnic University
Command Window
18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 1 11 / 24
Palestine Polytechnic University
18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 1 12 / 24
Palestine Polytechnic University
Data Manipulation
• Data are managed using a vector representation, using an
Array type
• Some examples:
• A line vector is defined using: A = [1 2] or A = [1,2] A=
a space or , are used to change of column 1 2
Matrix Manipulation
• To multiply matrix A by a matrix B of the same size: A.*B
Examples : with A = [1 2]; B = [3 4]; A= 1 2 B=3 4
A.*B 3 8 (= 1*3 2*4) term to term product
• To multiply matrix A by a constant
A.*5 5 10 (= 1*5 2*5)
• To do a scalar product of matrix A by a matrix B :
A*B’ 11 (= 1*3 + 4*2)
• To do a concatenation
[A B] 1 2 3 4
18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 1 14 / 24
Palestine Polytechnic University
18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 1 15 / 24
Palestine Polytechnic University
Examples: t = 0:1:10
time =
Columns 1 through 11
0 1 2 3 4 5 6 7 8 9 10
18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 1 16 / 24
Palestine Polytechnic University
18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 1 17 / 24
Palestine Polytechnic University
18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 1 19 / 24
Palestine Polytechnic University
Modification of a figure
• The figure properties can be modified using the button:
Edit Plot
Then, selection can be
made using left clicking
on the figure:
Line, Axis, Background…
And can be modified
by selecting:
Show Property Editor
18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 1 20 / 24
Palestine Polytechnic University
18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 1 21 / 24
Palestine Polytechnic University
The m-file
• Previous commands used in the Command Window can be re-
used in a text file : the “m-file” (due to the .m extension)
18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 1 22 / 24
Palestine Polytechnic University
To create a function
• To create a function toto returning a variable z calculated from
two parameters x and y:
z = toto(x,y);
• Create m-file with the name toto.m:
function f=toto(u,v)
f=u+3*v^2
• Call this function
z=toto(2,3)
ans=
29
18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 1 23 / 24
Palestine Polytechnic University
18-21 May 2009 Workshop Matlab/Simulink in Drives and Power electronics – Lecture 1 / 24