Professional Documents
Culture Documents
Preparing Figures in Matlab and L TEX For Quality Publications
Preparing Figures in Matlab and L TEX For Quality Publications
Publications
Azad Ghaffari
Vector Raster
Figures in Matlab
◮ Handle Graphics is an object-oriented structure for creating,
manipulating and displaying graphics
◮ Graphics objects: basic drawing elements used in Matlab to
display graphs and GUI components
◮ Every graphics object:
◮ Unique identifier, called a handle
◮ Set of characteristics, called properties
◮ Possible to modify every single property using the command-line
◮ Objects organized into a hierarchy
Root
Figure
Don’t
Do
0.8
Sinusoidal function
y=sin(t)
y = sin(t); 0.6
0.4
plot(t,y) 0.2
xlabel(’Time(s)’)
y(t)
0
-0.2
ylabel(’y(t)’) -0.4
-0.6
legend(’y=sin(t)’) -1
0 2 4 6
Time(s)
8 10 12 14
figure(’Units’,’inches’,...
’Position’,[x0 y0 width height],...
’PaperPositionMode’,’auto’);
-0.5
-1
0 5 10 15
Time(s)
Sinusoidal function
1.5
y=sin(t)
1
0.5
y(t)
0
-0.5
-1
-1.5
0 3.125 6.25 9.375 12.5
Time(s)
Labels and legend
LATEX typesetting by setting interpreter to latex
ylabel({’$y(t)$’},...
’FontUnits’,’points’,...
’interpreter’,’latex’,...
’FontSize’,9,...
’FontName’,’Times’)
xlabel(’Time(s)’,...
’FontUnits’,’points’,...
’FontWeight’,’normal’,...
’FontSize’,7,...
’FontName’,’Times’)
Labels, legend, and LATEX commands
legend({’$y=\sin(t)$’},...
’FontUnits’,’points’,...
’interpreter’,’latex’,...
’FontSize’,7,...
’FontName’,’Times’,...
’Location’,’NorthEast’)
title(’Sinusoidal function’,...
’FontUnits’,’points’,...
’FontWeight’,’normal’,...
’FontSize’,7,...
’FontName’,’Times’)
0
-0.5
-1
-1.5
0 3.125 6.25 9.375 12.5
Time(s)
How to save the plot
y(t)
0
-0.5
-1
-1.5
0 3.125 6.25 9.375 12.5
Time(s)
Exported .eps
Sinusoidal function
2
y = sin(t)
1.5
1
0.5
y(t)
0
-0.5
-1
-1.5
0 3.125 6.25 9.375 12.5
Printed .eps Time(s)
Inserting .eps in LATEX
\includegraphics[options]{myplot} is useful to change the
look of the .eps file
tion
unc
al f
usoid
Sin
2
1.5
1 75
9.3
0.5
5
6.2
)
0
y(t
e(s)
Tim
-0.5 125
-1 3.
-1.5 0
Ex. 1
(a) (b)
0 0
-100 -100
-200 -200
-300 -300
-400 (Γ11 )−1 (Γ22 )−1 -400
-500 -500
0 20 40 60 80 100 0 20 40 60 80 100
(c)
60
40 (Γ12 )−1 = (Γ21 )−1
20
0
-20
-40
0 20 40 60 80 100 120 140 160 180 200
Time(s)
Ex. 2
95
Newton
Gradient
Scalar
90
Step Down
b
85
D2 (%)
80
75
70
Step Up
a
65
50 55 60 65 70 75
D1 (%)
Ex. 3
(a) (c)
6 6
Current(A)
4 4
2 2
0 0 ◦C 1000 W/m2 0
0 10 2520◦ C 30 40 50 0 10 800 W/m
20 2 30 40 50
50 ◦ C (b) 600 W/m2 (d)
240 240
75 ◦ C 400 W/m2
Power(W)
160 160
80 80
0 0
0 10 20 30 40 50 0 10 20 30 40 50
Voltage(V) Voltage(V)
Ex. 4
280 200
(00 ◦
C, 1.0 kW/m2 ) Vw = 7 m/s
(25 ◦
C, 1.0 kW/m2 ) Vw = 9 m/s
(50 ◦
C, 1.0 kW/m2 ) Vw = 11m/s
(25 ◦
C, 0.8 kW/m2 ) Vw = 13 m/s
(25 ◦
C, 0.6 kW/m2 )
210 150
(25 ◦
C, 0.4 kW/m2 )
PV module Power (W)
70 50
0 0
0 10 20 30 40 50 0 2 4 6 8 10 12
Voltage(V) Shaft speed (rad/s)
Ex. 5
6 150
4 100
Current(A)
Power(W)
2 50
0 0
0 10 20 30 40 50 0 10 20 30 40 50
Voltage(V) Voltage(V)
Ex. 6
160
140
120
100
Pt (kW)
80
60
ES w/ inner control
40 ES w/o inner control
P&O w/ FOC
Pt∗
20
10 15 20 25 30 35 40
Time (s)
Ex. 7
70
350 350
380
65 400
420
430
60 35
38
0
0 440
30
40
5
0
44
D2 (%)
55
430
380
350
42
0
50
400
35
38
45 0
0
30
0
40
40 45 50 55 60 65 70
D1 (%)
Ex. 8
200
Vw = 7 m/s
Vw = 9
Vw = 11
Vw = 13
Turbine power, Pt (kW)
150
50
0
0 2 4 6 8 10 12
Turbine speed, ωt (rad/s)
Export Simulink models (Not for publication)
orient(gcs, ’portrait’)
h_theta_g h_G_g s
High pass
s+omega_h
h_theta_g
1
K*u Fout Fin
s
K_g Filter1
Interpreted
Sg(t)
MATLAB Fcn
Interpreted
MATLAB Fcn
Mg(t)
t
y_n
Interpreted
MATLAB Fcn
yn(t) y_n
Interpreted
MATLAB Fcn
Mn(t) s
Interpreted High pass1
Sn(t)
MATLAB Fcn s+omega_h
h_G_n
1 Matrix
K*u Multiply Fin
s Fout
-K_n Filter2
h_theta_n
Interpreted
H Gamma Sigma Fout Fin
h_theta_n MATLAB Fcn
inv Filter3
h_H_n Riccati
Interpreted
MATLAB Fcn
N(t)
Diagrams in LATEX– Picture environment
◮ For mathematical drawings
◮ Very limited options
◮ Time consuming
β = v/c = tanh χ
✻
✲ χ
θ y
✲ ẋ = f (x, α(x, θ)) ✲
y = h(x) ❄
s
S(t) M (t) s+ωh
❄ Ĝ ωl ✛ ×❄
Λ z =y−η
+ ✛ K ✛ −ΓĜ ✛ s+ωl
✛
s
✻ N (t)
Ĥ ωl Σ ❄
Γ̇ = ωr Γ − ωr ΓĤΓ✛ s+ωl
✛ ×✛
Diagrams in LATEX– LATEXCAD package
Vdc✛
D Multivariable ES Idc✛
T11 , S11 T12 , S12 T1n , S1n I1
✛
PV11 PV12 PV1n
d11 ✻ d12 ✻ d1n ✻
T21 , S21 T22 , S22 T2n , S2n I2
✛
PV21 PV22 PV2n
d21 ✻ d22 ✻ d2n ✻
PV1 V1 Vo1
P = Vdc Idc
D1
Converter Inverter
Multivariable MPPT
I2 Io2 Igrid
(T2 , S2 )
Converter
In Ion Idc
(Tn , Sn )
PVn Vn Von
Dn
Diagrams in LATEX– TikZ and PGF packages
D1 DC/DC V1 PV1 P1
D D2 DC/DC V2 PV2 P2 P = Vdc Idc
. . . . .
. . . . .
. . . . .
Dn DC/DC Vn PV n Pn
High-pass
S(t) M (t)
filter
D̂ K Ĝ Low-pass
+ −ΓĜ ×
s filter
N (t)
Ĥ Low-pass
Γ̇ = ρΓ − ρΓĤΓ ×
filter
Diagrams in LATEX– TikZ and PGF packages
SaA
Gearbox ratio = n ∼
Rotor inertia = J
Rotor frequency = ωr
ScC
Electrical circuits in LATEX– CrcuitTikZ package
PV1 + +
C
IC1
V1 C1′ MUR2020 Vo1
+
(T1 , S1 ) − IR2127 rC1
−
Electronic load
Vdc = 5V
I2 IRF640 IL2 L2 LA 25-NP Io2
◦
PV2 + C2 +
IC2
C2′
–
V2 MUR2020 Vo2
IL2
PWM1 PWM2 ADC5
IC2
ADC6
DS1104 Vo2
MPPT ADC8
Vdc
ADC7
How to convert LATEX-produced figures into .eps
Damiano Varagnolo,
How To Make Pretty Figures With Matlab,
http://www.ee.kth.se/˜damiano/Matlab/HowToMakePrettyFiguresWithMatlab.pdf
Version 8, 2010.
Yair Moshe,
Advanced Matlab Graphics and GUI,
http://sipl.technion.ac.il/new/Download/Matlab_Support/Matlab_Guides/Graphics%20and%20GUI
%20using%20Matlab.pdf
November, 2010.
Richard E. Turner, Umesh Rajashekar
Publication quality figures using Matlab,
http://www.gatsby.ucl.ac.uk/˜turner/TeaTalks/matlabFigs/matlabFig.pdf
June, 2011.
Jeffrey D. Hein,
Creating .eps figures using TikZ,
http://heinjd.wordpress.com/2010/04/28/creating-eps-figures-using-tikz/
April, 2010.