MATLAB for ex3 done

This commit is contained in:
Claudio Maggioni (maggicl) 2021-03-22 15:31:56 +01:00
parent 85bb62cced
commit 9ce1520076
7 changed files with 11290 additions and 14201 deletions

5240
hw1/contour.tex Normal file

File diff suppressed because one or more lines are too long

161
hw1/ex3.asv Normal file
View file

@ -0,0 +1,161 @@
%% Homework 1 - Optimization Methods
% Author: Claudio Maggioni
%
% Sources:
% - https://www.youtube.com/watch?v=91RZYO1cv_o
clear
clc
close all
format short
%% Exercise 3.1
% f(x1, x2) = x1^2 + u * x2^2;
% 1/2 * [x1 x2] [2 0] [x1] + [0][x1]
% [0 2u] [x2] + [0][x2]
% A = [1 0; 0 u]; b = [0; 0]
%% Exercise 3.2
xaxis = -10:1:10;
yaxis = xaxis;
Zn = zeros(size(xaxis, 2), size(yaxis, 2));
Zs = {Zn,Zn,Zn,Zn,Zn,Zn,Zn,Zn,Zn,Zn};
for u = 1:10
A = [1 0; 0 u];
for i = 1:size(xaxis, 2)
for j = 1:size(yaxis, 2)
vec = [xaxis(i); yaxis(j)];
Zs{u}(i, j) = vec' * A * vec;
end
end
end
for u = 1:10
subplot(2, 5, u);
h = surf(xaxis, yaxis, Zs{u});
set(h,'LineStyle','none');
title(sprintf("u=%d", u));
end
sgtitle("Surf plots");
% comment these lines on submission
addpath /home/claudio/git/matlab2tikz/src
matlab2tikz('showInfo', false, './surf.tex')
figure
yi = zeros(30, 25);
ni = zeros(30, 25);
its = zeros(30, 1);
for u = 1:10
subplot(2, 5, u);
contour(xaxis, yaxis, Zs{u}, 10);
title(sprintf("u=%d", u));
%% Exercise 3.3
A = [2 0; 0 2*u];
b = [0; 0];
xs = [[0; 10] [10; 0] [10; 10]];
syms sx sy
f = 1/2 * [sx sy] * A * [sx; sy];
g = gradient(f, [sx; sy]);
hold on
j = 1;
for x0 = xs
ri = u * 3 - 3 + j;
x = x0;
i = 1;
xi = zeros(2, 25);
xi(:, 1) = x0;
yi(ri, 1) = subs(f, [sx sy], x0');
while true
p = -1 * double(subs(g, [sx sy], x'));
ni(ri, i) = log10(norm(p, 2));
if norm(p, 2) == 0 || ni(ri, i) <= -8
break
end
alpha = dot(b - A * x, p) / dot(A * p, p);
x = x + alpha * p;
i = i + 1;
xi(:, i) = x;
yi(ri, i) = subs(f, [sx sy], x');
end
xi = xi(:, 1:i);
plot(xi(1, :), xi(2, :), '-');
fprintf("u=%2d x0=[%2d,%2d] it=%2d x=[%d,%d]\n", u, ...
x0(1), x0(2), i, x(1), x(2));
its(ri) = i;
j = j + 1;
end
hold off
end
sgtitle("Contour plots and iteration steps");
% comment these lines on submission
addpath /home/claudio/git/matlab2tikz/src
matlab2tikz('showInfo', false, './contour.tex')
figure
for u = 1:10
subplot(2, 5, u);
title(sprintf("u=%d", u));
hold on
for j = 1:3
ri = u * 3 - 3 + j;
vec = yi(ri, :);
vec = vec(1:its(ri));
plot(1:its(ri), vec);
end
hold off
end
sgtitle("Iterations over values of objective function");
% comment these lines on submission
addpath /home/claudio/git/matlab2tikz/src
matlab2tikz('showInfo', false, './yseries.tex')
figure
for u = 1:10
title(sprintf("u=%d", u));
subplot(2, 5, u);
hold on
for j = 1:3
ri = u * 3 - 3 + j;
vec = ni(ri, :);
vec = vec(1:its(ri));
plot(1:its(ri), vec);
end
hold off
end
% comment these lines on submission
addpath /home/claudio/git/matlab2tikz/src
matlab2tikz('showInfo', false, './norms.tex')

168
hw1/ex3.m
View file

@ -1,5 +1,13 @@
%% Homework 1 - Optimization Methods
% Author: Claudio Maggioni
%
% Sources: % Sources:
% https://www.youtube.com/watch?v=91RZYO1cv_o % - https://www.youtube.com/watch?v=91RZYO1cv_o
clear
clc
close all
format short
%% Exercise 3.1 %% Exercise 3.1
@ -11,38 +19,144 @@
% A = [1 0; 0 u]; b = [0; 0] % A = [1 0; 0 u]; b = [0; 0]
%% Exercise 3.2 %% Exercise 3.2
xaxis = -10:1:10;
yaxis = xaxis;
Zn = zeros(size(xaxis, 2), size(yaxis, 2));
Zs = {Zn,Zn,Zn,Zn,Zn,Zn,Zn,Zn,Zn,Zn};
for u = 1:10 for u = 1:10
A = [1 0; 0 u]; A = [1 0; 0 u];
xs = -10:1:10; for i = 1:size(xaxis, 2)
ys = xs; for j = 1:size(yaxis, 2)
vec = [xaxis(i); yaxis(j)];
Z = zeros(size(xs, 2), size(ys, 2)); Zs{u}(i, j) = vec' * A * vec;
end
for i = 1:size(xs, 2)
for j = 1:size(ys, 2)
vec = [xs(i); ys(j)];
Z(i, j) = vec' * A * vec;
end end
end end
if u <= 5 for u = 1:10
fig = u; subplot(2, 5, u);
con = 5 + u; h = surf(xaxis, yaxis, Zs{u});
else
fig = 10 + u - 5;
con = 15 + u - 5;
end
subplot(4, 5, fig);
h = surf(xs, ys, Z);
set(h,'LineStyle','none'); set(h,'LineStyle','none');
title(sprintf("Surf for u=%d", u)); title(sprintf("u=%d", u));
subplot(4, 5, con);
contour(xs, ys, Z, 20);
title(sprintf("Contour for u=%d", u));
end end
matlab2tikz('showInfo', false, './ex32.tex') sgtitle("Surf plots");
% comment these lines on submission
addpath /home/claudio/git/matlab2tikz/src
matlab2tikz('showInfo', false, './surf.tex')
figure
yi = zeros(30, 25);
ni = zeros(30, 25);
its = zeros(30, 1);
for u = 1:10
subplot(2, 5, u);
contour(xaxis, yaxis, Zs{u}, 10);
title(sprintf("u=%d", u));
%% Exercise 3.3
A = [2 0; 0 2*u];
b = [0; 0];
xs = [[0; 10] [10; 0] [10; 10]];
syms sx sy
f = 1/2 * [sx sy] * A * [sx; sy];
g = gradient(f, [sx; sy]);
hold on
j = 1;
for x0 = xs
ri = u * 3 - 3 + j;
x = x0;
i = 1;
xi = zeros(2, 25);
xi(:, 1) = x0;
yi(ri, 1) = subs(f, [sx sy], x0');
while true
p = -1 * double(subs(g, [sx sy], x'));
ni(ri, i) = log10(norm(p, 2));
if norm(p, 2) == 0 || ni(ri, i) <= -8
break
end
alpha = dot(b - A * x, p) / dot(A * p, p);
x = x + alpha * p;
i = i + 1;
xi(:, i) = x;
yi(ri, i) = subs(f, [sx sy], x');
end
xi = xi(:, 1:i);
plot(xi(1, :), xi(2, :), '-');
fprintf("u=%2d x0=[%2d,%2d] it=%2d x=[%d,%d]\n", u, ...
x0(1), x0(2), i, x(1), x(2));
its(ri) = i;
j = j + 1;
end
hold off
end
sgtitle("Contour plots and iteration steps");
% comment these lines on submission
addpath /home/claudio/git/matlab2tikz/src
matlab2tikz('showInfo', false, './contour.tex')
figure
for u = 1:10
subplot(2, 5, u);
title(sprintf("u=%d", u));
hold on
for j = 1:3
ri = u * 3 - 3 + j;
vec = yi(ri, :);
vec = vec(1:its(ri));
plot(1:its(ri), vec);
end
hold off
end
sgtitle("Iterations over values of objective function");
% comment these lines on submission
addpath /home/claudio/git/matlab2tikz/src
matlab2tikz('showInfo', false, './yseries.tex')
figure
for u = 1:10
subplot(2, 5, u);
hold on
for j = 1:3
ri = u * 3 - 3 + j;
vec = ni(ri, :);
vec = vec(1:its(ri));
plot(1:its(ri), vec);
end
hold off
title(sprintf("u=%d", u));
end
sgtitle("Iterations over log10 of gradient norms");
% comment these lines on submission
addpath /home/claudio/git/matlab2tikz/src
matlab2tikz('showInfo', false, './norms.tex')

14172
hw1/ex32.tex

File diff suppressed because one or more lines are too long

506
hw1/norms.tex Normal file
View file

@ -0,0 +1,506 @@
% This file was created by matlab2tikz.
%
\definecolor{mycolor1}{rgb}{0.00000,0.44700,0.74100}%
\definecolor{mycolor2}{rgb}{0.85000,0.32500,0.09800}%
\definecolor{mycolor3}{rgb}{0.92900,0.69400,0.12500}%
%
\begin{tikzpicture}
\begin{axis}[%
width=0.737in,
height=1.524in,
at={(0.774in,2.609in)},
scale only axis,
unbounded coords=jump,
xmin=-0,
xmax=2,
ymin=1.3,
ymax=1.45154499349597,
axis background/.style={fill=white},
title style={font=\bfseries},
title={u=1},
axis x line*=bottom,
axis y line*=left
]
\addplot [color=mycolor1, forget plot]
table[row sep=crcr]{%
1 1.30102999566398\\
2 -inf\\
};
\addplot [color=mycolor2, forget plot]
table[row sep=crcr]{%
1 1.30102999566398\\
2 -inf\\
};
\addplot [color=mycolor3, forget plot]
table[row sep=crcr]{%
1 1.45154499349597\\
2 -inf\\
};
\end{axis}
\begin{axis}[%
width=0.737in,
height=1.524in,
at={(1.744in,2.609in)},
scale only axis,
unbounded coords=jump,
xmin=0,
xmax=20,
ymin=-10,
ymax=2,
axis background/.style={fill=white},
title style={font=\bfseries},
title={u=2},
axis x line*=bottom,
axis y line*=left
]
\addplot [color=mycolor1, forget plot]
table[row sep=crcr]{%
1 1.60205999132796\\
2 -inf\\
};
\addplot [color=mycolor2, forget plot]
table[row sep=crcr]{%
1 1.30102999566398\\
2 -inf\\
};
\addplot [color=mycolor3, forget plot]
table[row sep=crcr]{%
1 1.65051499783199\\
2 0.997302484056647\\
3 0.520181229336984\\
4 -0.133031284438359\\
5 -0.610152539158022\\
6 -1.26336505293337\\
7 -1.74048630765303\\
8 -2.39369882142837\\
9 -2.87082007614804\\
10 -3.52403258992338\\
11 -4.00115384464304\\
12 -4.65436635841838\\
13 -5.13148761313805\\
14 -5.78470012691339\\
15 -6.26182138163305\\
16 -6.91503389540839\\
17 -7.39215515012806\\
18 -8.0453676639034\\
};
\end{axis}
\begin{axis}[%
width=0.737in,
height=1.524in,
at={(2.714in,2.609in)},
scale only axis,
unbounded coords=jump,
xmin=0,
xmax=22,
ymin=-10,
ymax=2,
axis background/.style={fill=white},
title style={font=\bfseries},
title={u=3},
axis x line*=bottom,
axis y line*=left
]
\addplot [color=mycolor1, forget plot]
table[row sep=crcr]{%
1 1.77815125038364\\
2 -inf\\
};
\addplot [color=mycolor2, forget plot]
table[row sep=crcr]{%
1 1.30102999566398\\
2 -inf\\
};
\addplot [color=mycolor3, forget plot]
table[row sep=crcr]{%
1 1.80102999566398\\
2 1.13202321470541\\
3 0.830993219041424\\
4 0.161986438082849\\
5 -0.139043557581132\\
6 -0.808050338539708\\
7 -1.10908033420369\\
8 -1.77808711516227\\
9 -2.07911711082625\\
10 -2.74812389178482\\
11 -3.0491538874488\\
12 -3.71816066840738\\
13 -4.01919066407136\\
14 -4.68819744502994\\
15 -4.98922744069392\\
16 -5.65823422165249\\
17 -5.95926421731647\\
18 -6.62827099827505\\
19 -6.92930099393903\\
20 -7.5983077748976\\
21 -7.89933777056158\\
22 -8.56834455152016\\
};
\end{axis}
\begin{axis}[%
width=0.737in,
height=1.524in,
at={(3.684in,2.609in)},
scale only axis,
unbounded coords=jump,
xmin=0,
xmax=22,
ymin=-10,
ymax=2,
axis background/.style={fill=white},
title style={font=\bfseries},
title={u=4},
axis x line*=bottom,
axis y line*=left
]
\addplot [color=mycolor1, forget plot]
table[row sep=crcr]{%
1 1.90308998699194\\
2 -inf\\
};
\addplot [color=mycolor2, forget plot]
table[row sep=crcr]{%
1 1.30102999566398\\
2 -inf\\
};
\addplot [color=mycolor3, forget plot]
table[row sep=crcr]{%
1 1.91625445635312\\
2 1.18252234575789\\
3 0.960673596141531\\
4 0.2269414855463\\
5 0.00509273592994392\\
6 -0.728639374665287\\
7 -0.950488124281644\\
8 -1.68422023487687\\
9 -1.90606898449323\\
10 -2.63980109508846\\
11 -2.86164984470481\\
12 -3.59538195530004\\
13 -3.8172307049164\\
14 -4.55096281551162\\
15 -4.77281156512798\\
16 -5.5065436757232\\
17 -5.72839242533956\\
18 -6.46212453593479\\
19 -6.68397328555114\\
20 -7.41770539614637\\
21 -7.63955414576272\\
22 -8.37328625635795\\
};
\end{axis}
\begin{axis}[%
width=0.737in,
height=1.524in,
at={(4.654in,2.609in)},
scale only axis,
unbounded coords=jump,
xmin=0,
xmax=22,
ymin=-10,
ymax=2.00851666964939,
axis background/.style={fill=white},
title style={font=\bfseries},
title={u=5},
axis x line*=bottom,
axis y line*=left
]
\addplot [color=mycolor1, forget plot]
table[row sep=crcr]{%
1 2\\
2 -inf\\
};
\addplot [color=mycolor2, forget plot]
table[row sep=crcr]{%
1 1.30102999566398\\
2 -inf\\
};
\addplot [color=mycolor3, forget plot]
table[row sep=crcr]{%
1 2.00851666964939\\
2 1.20917612019581\\
3 1.03308486114013\\
4 0.233744311686546\\
5 0.0576530526308642\\
6 -0.741687496822717\\
7 -0.917778755878399\\
8 -1.71711930533198\\
9 -1.89321056438766\\
10 -2.69255111384125\\
11 -2.86864237289693\\
12 -3.66798292235051\\
13 -3.84407418140619\\
14 -4.64341473085978\\
15 -4.81950598991546\\
16 -5.61884653936904\\
17 -5.79493779842472\\
18 -6.59427834787831\\
19 -6.77036960693399\\
20 -7.56971015638758\\
21 -7.74580141544326\\
22 -8.54514196489685\\
};
\end{axis}
\begin{axis}[%
width=0.737in,
height=1.524in,
at={(0.774in,0.491in)},
scale only axis,
unbounded coords=jump,
xmin=0,
xmax=22,
ymin=-10,
ymax=2.08513085769748,
axis background/.style={fill=white},
title style={font=\bfseries},
title={u=6},
axis x line*=bottom,
axis y line*=left
]
\addplot [color=mycolor1, forget plot]
table[row sep=crcr]{%
1 2.07918124604762\\
2 -inf\\
};
\addplot [color=mycolor2, forget plot]
table[row sep=crcr]{%
1 1.30102999566398\\
2 -inf\\
};
\addplot [color=mycolor3, forget plot]
table[row sep=crcr]{%
1 2.08513085769748\\
2 1.22579237856861\\
3 1.07966434289037\\
4 0.220325863761506\\
5 0.0741978280832662\\
6 -0.785140651045603\\
7 -0.931268686723842\\
8 -1.79060716585271\\
9 -1.93673520153095\\
10 -2.79607368065982\\
11 -2.94220171633806\\
12 -3.80154019546693\\
13 -3.94766823114517\\
14 -4.80700671027403\\
15 -4.95313474595227\\
16 -5.81247322508113\\
17 -5.95860126075937\\
18 -6.81793973988824\\
19 -6.96406777556648\\
20 -7.82340625469535\\
21 -7.96953429037359\\
22 -8.82887276950246\\
};
\end{axis}
\begin{axis}[%
width=0.737in,
height=1.524in,
at={(1.744in,0.491in)},
scale only axis,
unbounded coords=jump,
xmin=0,
xmax=20,
ymin=-10,
ymax=2.15051499783199,
axis background/.style={fill=white},
title style={font=\bfseries},
title={u=7},
axis x line*=bottom,
axis y line*=left
]
\addplot [color=mycolor1, forget plot]
table[row sep=crcr]{%
1 2.14612803567824\\
2 -inf\\
};
\addplot [color=mycolor2, forget plot]
table[row sep=crcr]{%
1 1.30102999566398\\
2 -inf\\
};
\addplot [color=mycolor3, forget plot]
table[row sep=crcr]{%
1 2.15051499783199\\
2 1.23720584565836\\
3 1.11226710905006\\
4 0.198957956876431\\
5 0.0740192202681324\\
6 -0.839289931905496\\
7 -0.964228668513796\\
8 -1.87753782068742\\
9 -2.00247655729572\\
10 -2.91578570946935\\
11 -3.04072444607765\\
12 -3.95403359825128\\
13 -4.07897233485958\\
14 -4.99228148703321\\
15 -5.11722022364151\\
16 -6.03052937581514\\
17 -6.15546811242343\\
18 -7.06877726459706\\
19 -7.19371600120536\\
20 -8.107025153379\\
};
\end{axis}
\begin{axis}[%
width=0.737in,
height=1.524in,
at={(2.714in,0.491in)},
scale only axis,
unbounded coords=jump,
xmin=0,
xmax=20,
ymin=-10,
ymax=2.20748667398541,
axis background/.style={fill=white},
title style={font=\bfseries},
title={u=8},
axis x line*=bottom,
axis y line*=left
]
\addplot [color=mycolor1, forget plot]
table[row sep=crcr]{%
1 2.20411998265593\\
2 -inf\\
};
\addplot [color=mycolor2, forget plot]
table[row sep=crcr]{%
1 1.30102999566398\\
2 -inf\\
};
\addplot [color=mycolor3, forget plot]
table[row sep=crcr]{%
1 2.20748667398541\\
2 1.24555733587979\\
3 1.13641286645473\\
4 0.174483528349108\\
5 0.0653390589240416\\
6 -0.896590279181573\\
7 -1.00573474860664\\
8 -1.96766408671225\\
9 -2.07680855613731\\
10 -3.03873789424292\\
11 -3.14788236366798\\
12 -4.10981170177359\\
13 -4.21895617119864\\
14 -5.18088550930425\\
15 -5.2900299787293\\
16 -6.25195931683491\\
17 -6.36110378625996\\
18 -7.32303312436556\\
19 -7.43217759379062\\
20 -8.39410693189622\\
};
\end{axis}
\begin{axis}[%
width=0.737in,
height=1.524in,
at={(3.684in,0.491in)},
scale only axis,
unbounded coords=jump,
xmin=0,
xmax=20,
ymin=-10,
ymax=2.25793692185584,
axis background/.style={fill=white},
title style={font=\bfseries},
title={u=9},
axis x line*=bottom,
axis y line*=left
]
\addplot [color=mycolor1, forget plot]
table[row sep=crcr]{%
1 2.25527250510331\\
2 -inf\\
};
\addplot [color=mycolor2, forget plot]
table[row sep=crcr]{%
1 1.30102999566398\\
2 -inf\\
};
\addplot [color=mycolor3, forget plot]
table[row sep=crcr]{%
1 2.25793692185584\\
2 1.25194655816665\\
3 1.1550365451586\\
4 0.149046181469408\\
5 0.0521361684613511\\
6 -0.953854195227838\\
7 -1.0507642082359\\
8 -2.05675457192509\\
9 -2.15366458493314\\
10 -3.15965494862233\\
11 -3.25656496163038\\
12 -4.26255532531956\\
13 -4.35946533832761\\
14 -5.36545570201678\\
15 -5.46236571502484\\
16 -6.46835607871402\\
17 -6.56526609172207\\
18 -7.57125645541125\\
19 -7.6681664684193\\
20 -8.67415683210849\\
};
\end{axis}
\begin{axis}[%
width=0.737in,
height=1.524in,
at={(4.654in,0.491in)},
scale only axis,
unbounded coords=jump,
xmin=0,
xmax=20,
ymin=-10,
ymax=5,
axis background/.style={fill=white},
title style={font=\bfseries},
title={u=10},
axis x line*=bottom,
axis y line*=left
]
\addplot [color=mycolor1, forget plot]
table[row sep=crcr]{%
1 2.30102999566398\\
2 -inf\\
};
\addplot [color=mycolor2, forget plot]
table[row sep=crcr]{%
1 1.30102999566398\\
2 -inf\\
};
\addplot [color=mycolor3, forget plot]
table[row sep=crcr]{%
1 2.3031906825553\\
2 1.25699911451531\\
3 1.16984893879641\\
4 0.123657370756415\\
5 0.036507195037518\\
6 -1.00968437300247\\
7 -1.09683454872137\\
8 -2.14302611676136\\
9 -2.23017629248025\\
10 -3.27636786052022\\
11 -3.36351803623911\\
12 -4.40970960427909\\
13 -4.49685977999798\\
14 -5.54305134803795\\
15 -5.63020152375682\\
16 -6.67639309179679\\
17 -6.76354326751565\\
18 -7.80973483555561\\
19 -7.89688501127448\\
20 -8.94307657931444\\
};
\end{axis}
\end{tikzpicture}%

4744
hw1/surf.tex Normal file

File diff suppressed because one or more lines are too long

496
hw1/yseries.tex Normal file
View file

@ -0,0 +1,496 @@
% This file was created by matlab2tikz.
%
\definecolor{mycolor1}{rgb}{0.00000,0.44700,0.74100}%
\definecolor{mycolor2}{rgb}{0.85000,0.32500,0.09800}%
\definecolor{mycolor3}{rgb}{0.92900,0.69400,0.12500}%
%
\begin{tikzpicture}
\begin{axis}[%
width=0.737in,
height=1.524in,
at={(0.774in,2.609in)},
scale only axis,
xmin=1,
xmax=2,
ymin=0,
ymax=200,
axis background/.style={fill=white},
title style={font=\bfseries},
title={u=1},
axis x line*=bottom,
axis y line*=left
]
\addplot [color=mycolor1, forget plot]
table[row sep=crcr]{%
1 100\\
2 0\\
};
\addplot [color=mycolor2, forget plot]
table[row sep=crcr]{%
1 100\\
2 0\\
};
\addplot [color=mycolor3, forget plot]
table[row sep=crcr]{%
1 200\\
2 0\\
};
\end{axis}
\begin{axis}[%
width=0.737in,
height=1.524in,
at={(1.744in,2.609in)},
scale only axis,
xmin=0,
xmax=20,
ymin=0,
ymax=300,
axis background/.style={fill=white},
title style={font=\bfseries},
title={u=2},
axis x line*=bottom,
axis y line*=left
]
\addplot [color=mycolor1, forget plot]
table[row sep=crcr]{%
1 200\\
2 0\\
};
\addplot [color=mycolor2, forget plot]
table[row sep=crcr]{%
1 100\\
2 0\\
};
\addplot [color=mycolor3, forget plot]
table[row sep=crcr]{%
1 300\\
2 22.2222222222222\\
3 1.64609053497942\\
4 0.121932632220698\\
5 0.00903204683116282\\
6 0.000669040506012061\\
7 4.95585560008934e-05\\
8 3.67100414821429e-06\\
9 2.71926233201059e-07\\
10 2.01426839408192e-08\\
11 1.49205066228291e-09\\
12 1.10522271280216e-10\\
13 8.18683490964562e-12\\
14 6.06432215529306e-13\\
15 4.49209048540228e-14\\
16 3.32747443363132e-15\\
17 2.46479587676395e-16\\
18 1.82577472352886e-17\\
};
\end{axis}
\begin{axis}[%
width=0.737in,
height=1.524in,
at={(2.714in,2.609in)},
scale only axis,
xmin=0,
xmax=22,
ymin=0,
ymax=400,
axis background/.style={fill=white},
title style={font=\bfseries},
title={u=3},
axis x line*=bottom,
axis y line*=left
]
\addplot [color=mycolor1, forget plot]
table[row sep=crcr]{%
1 300\\
2 0\\
};
\addplot [color=mycolor2, forget plot]
table[row sep=crcr]{%
1 100\\
2 0\\
};
\addplot [color=mycolor3, forget plot]
table[row sep=crcr]{%
1 400\\
2 42.8571428571429\\
3 4.59183673469388\\
4 0.49198250728863\\
5 0.0527124114952103\\
6 0.00564775837448682\\
7 0.000605116968695017\\
8 6.48339609316086e-05\\
9 6.94649581410093e-06\\
10 7.44267408653673e-07\\
11 7.97429366414647e-08\\
12 8.54388606872834e-09\\
13 9.15416364506611e-10\\
14 9.80803247685657e-11\\
15 1.05086062252035e-11\\
16 1.12592209555752e-12\\
17 1.20634510238306e-13\\
18 1.29251260969615e-14\\
19 1.38483493896016e-15\\
20 1.48375172031446e-16\\
21 1.58973398605121e-17\\
22 1.7032864136263e-18\\
};
\end{axis}
\begin{axis}[%
width=0.737in,
height=1.524in,
at={(3.684in,2.609in)},
scale only axis,
xmin=0,
xmax=22,
ymin=0,
ymax=500,
axis background/.style={fill=white},
title style={font=\bfseries},
title={u=4},
axis x line*=bottom,
axis y line*=left
]
\addplot [color=mycolor1, forget plot]
table[row sep=crcr]{%
1 400\\
2 0\\
};
\addplot [color=mycolor2, forget plot]
table[row sep=crcr]{%
1 100\\
2 0\\
};
\addplot [color=mycolor3, forget plot]
table[row sep=crcr]{%
1 500\\
2 55.3846153846154\\
3 6.13491124260355\\
4 0.679559399180701\\
5 0.0752742719092469\\
6 0.00833807319610118\\
7 0.000923601954029666\\
8 0.000102306677984825\\
9 1.13324320229345e-05\\
10 1.25528477792505e-06\\
11 1.39046929247084e-07\\
12 1.54021213935233e-08\\
13 1.70608113897492e-09\\
14 1.88981295394148e-10\\
15 2.09333127205828e-11\\
16 2.31876694751075e-12\\
17 2.56848031108886e-13\\
18 2.84508588305232e-14\\
19 3.15147974738106e-15\\
20 3.49086987402213e-16\\
21 3.86680970660916e-17\\
22 4.28323536732096e-18\\
};
\end{axis}
\begin{axis}[%
width=0.737in,
height=1.524in,
at={(4.654in,2.609in)},
scale only axis,
xmin=0,
xmax=22,
ymin=0,
ymax=600,
axis background/.style={fill=white},
title style={font=\bfseries},
title={u=5},
axis x line*=bottom,
axis y line*=left
]
\addplot [color=mycolor1, forget plot]
table[row sep=crcr]{%
1 500\\
2 0\\
};
\addplot [color=mycolor2, forget plot]
table[row sep=crcr]{%
1 100\\
2 0\\
};
\addplot [color=mycolor3, forget plot]
table[row sep=crcr]{%
1 600\\
2 63.4920634920635\\
3 6.71873687746704\\
4 0.710977447351009\\
5 0.0752357087143925\\
6 0.00796145065760769\\
7 0.000842481551069593\\
8 8.91514868856708e-05\\
9 9.43401977626147e-06\\
10 9.98308971032958e-07\\
11 1.05641160955868e-07\\
12 1.11789588313087e-08\\
13 1.18295860648769e-09\\
14 1.25180804919332e-10\\
15 1.32466460232096e-11\\
16 1.40176148393752e-12\\
17 1.48334548564816e-13\\
18 1.56967776259064e-14\\
19 1.66103466940806e-15\\
20 1.75770864487622e-16\\
21 1.86000914801713e-17\\
22 1.96826364869535e-18\\
};
\end{axis}
\begin{axis}[%
width=0.737in,
height=1.524in,
at={(0.774in,0.491in)},
scale only axis,
xmin=0,
xmax=22,
ymin=0,
ymax=800,
axis background/.style={fill=white},
title style={font=\bfseries},
title={u=6},
axis x line*=bottom,
axis y line*=left
]
\addplot [color=mycolor1, forget plot]
table[row sep=crcr]{%
1 600\\
2 0\\
};
\addplot [color=mycolor2, forget plot]
table[row sep=crcr]{%
1 100\\
2 0\\
};
\addplot [color=mycolor3, forget plot]
table[row sep=crcr]{%
1 700\\
2 69.1244239631336\\
3 6.82597998319292\\
4 0.674059906174414\\
5 0.0665628610442141\\
6 0.00657302775288482\\
7 0.000649081081588358\\
8 6.4096222671661e-05\\
9 6.32944924341607e-06\\
10 6.25027904221459e-07\\
11 6.17209912002754e-08\\
12 6.09489709021807e-09\\
13 6.0186607210844e-10\\
14 5.94337793392146e-11\\
15 5.86903680110745e-12\\
16 5.79562554421411e-13\\
17 5.72313253214028e-14\\
18 5.65154627926948e-15\\
19 5.58085544364985e-16\\
20 5.51104882519728e-17\\
21 5.44211536392088e-18\\
22 5.37404413817065e-19\\
};
\end{axis}
\begin{axis}[%
width=0.737in,
height=1.524in,
at={(1.744in,0.491in)},
scale only axis,
xmin=0,
xmax=20,
ymin=0,
ymax=800,
axis background/.style={fill=white},
title style={font=\bfseries},
title={u=7},
axis x line*=bottom,
axis y line*=left
]
\addplot [color=mycolor1, forget plot]
table[row sep=crcr]{%
1 700\\
2 0\\
};
\addplot [color=mycolor2, forget plot]
table[row sep=crcr]{%
1 100\\
2 0\\
};
\addplot [color=mycolor3, forget plot]
table[row sep=crcr]{%
1 800\\
2 73.2558139534884\\
3 6.70801784748513\\
4 0.614251634290062\\
5 0.056246879302724\\
6 0.00515051365708086\\
7 0.000471631337785022\\
8 4.31871719192681e-05\\
9 3.95463928911904e-06\\
10 3.62125400021075e-07\\
11 3.31597386647204e-08\\
12 3.0364295579613e-09\\
13 2.78045148476112e-10\\
14 2.54605295842955e-11\\
15 2.33141477298056e-12\\
16 2.13487108572348e-13\\
17 1.95489648838053e-14\\
18 1.79009416813917e-15\\
19 1.63918506675532e-16\\
20 1.50099795356954e-17\\
};
\end{axis}
\begin{axis}[%
width=0.737in,
height=1.524in,
at={(2.714in,0.491in)},
scale only axis,
xmin=0,
xmax=20,
ymin=0,
ymax=1000,
axis background/.style={fill=white},
title style={font=\bfseries},
title={u=8},
axis x line*=bottom,
axis y line*=left
]
\addplot [color=mycolor1, forget plot]
table[row sep=crcr]{%
1 800\\
2 0\\
};
\addplot [color=mycolor2, forget plot]
table[row sep=crcr]{%
1 100\\
2 0\\
};
\addplot [color=mycolor3, forget plot]
table[row sep=crcr]{%
1 900\\
2 76.4132553606238\\
3 6.48776177200878\\
4 0.550834441114886\\
5 0.0467678364559317\\
6 0.00397075847752336\\
7 0.000337131757242625\\
8 2.86237056181747e-05\\
9 2.43025614085441e-06\\
10 2.06337536758709e-07\\
11 1.75188032075842e-08\\
12 1.4874097590152e-09\\
13 1.26286468601687e-10\\
14 1.07221779709474e-11\\
15 9.1035169257345e-13\\
16 7.72921515028835e-14\\
17 6.56238323351357e-15\\
18 5.57170073107532e-16\\
19 4.73057545285173e-17\\
20 4.01642966757197e-18\\
};
\end{axis}
\begin{axis}[%
width=0.737in,
height=1.524in,
at={(3.684in,0.491in)},
scale only axis,
xmin=0,
xmax=20,
ymin=0,
ymax=1000,
axis background/.style={fill=white},
title style={font=\bfseries},
title={u=9},
axis x line*=bottom,
axis y line*=left
]
\addplot [color=mycolor1, forget plot]
table[row sep=crcr]{%
1 900\\
2 0\\
};
\addplot [color=mycolor2, forget plot]
table[row sep=crcr]{%
1 100\\
2 0\\
};
\addplot [color=mycolor3, forget plot]
table[row sep=crcr]{%
1 1000\\
2 78.9041095890411\\
3 6.22585851003941\\
4 0.491245822162014\\
5 0.0387613141870299\\
6 0.00305842698242864\\
7 0.000241322457791625\\
8 1.90413336558868e-05\\
9 1.50243947750561e-06\\
10 1.18548649184006e-07\\
11 9.35397560684789e-09\\
12 7.38067116375966e-10\\
13 5.82365286345992e-11\\
14 4.59510143746993e-12\\
15 3.62572387394896e-13\\
16 2.86084513889678e-14\\
17 2.25732438356794e-15\\
18 1.78112170539065e-16\\
19 1.40537822233565e-17\\
20 1.10890117269225e-18\\
};
\end{axis}
\begin{axis}[%
width=0.737in,
height=1.524in,
at={(4.654in,0.491in)},
scale only axis,
xmin=0,
xmax=20,
ymin=0,
ymax=1200,
axis background/.style={fill=white},
title style={font=\bfseries},
title={u=10},
axis x line*=bottom,
axis y line*=left
]
\addplot [color=mycolor1, forget plot]
table[row sep=crcr]{%
1 1000\\
2 0\\
};
\addplot [color=mycolor2, forget plot]
table[row sep=crcr]{%
1 100\\
2 0\\
};
\addplot [color=mycolor3, forget plot]
table[row sep=crcr]{%
1 1100\\
2 80.9190809190809\\
3 5.95263423344433\\
4 0.437892446561612\\
5 0.0322125948337945\\
6 0.00236964869815402\\
7 0.000174317995232476\\
8 1.28233199653353e-05\\
9 9.4331933266028e-07\\
10 6.93932121927965e-08\\
11 5.10475904787649e-09\\
12 3.75520373152318e-10\\
13 2.76243304198895e-11\\
14 2.03212311689333e-12\\
15 1.49488668121317e-13\\
16 1.09968051201783e-14\\
17 8.08955784882926e-16\\
18 5.9509053288101e-17\\
19 4.37765263494403e-18\\
20 3.22032388911561e-19\\
};
\end{axis}
\end{tikzpicture}%