%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                            Michael Pokojovy                             % 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

set(gcf, 'PaperUnits', 'centimeters');
xSize = 24; ySize = 12;
xLeft = (21 - xSize)/2; yTop = (30 - ySize)/2;
set(gcf,'PaperPosition', [xLeft yTop xSize ySize]);
set(gcf,'Position',[0 0 xSize*50 ySize*50]);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure(1);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
subplot(1, 3, 1);

t = title('$v(x) = (x_{2}, x_{2} - x_{1})^{T}$', 'interpreter', 'latex');
set(t, 'FontSize', 16);

[X, Y] = meshgrid(0:0.1:1);
U = zeros(size(X));
V = zeros(size(Y));

for i = 1:size(X, 1)
for j = 1:size(X, 2)
    x = X(i, j);
    y = Y(i, j);
    U(i, j) = y;
    V(i, j) = y - x;
end
end

hold on;
grid on;
quiver(X, Y, U, V);

t = 0:0.05:1;
plot(t, t, 'r');
axis([0 1.1 -0.1 1.1]);

xlabel('x_{1}');
ylabel('x_{2}');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
subplot(1, 3, 2);

t = title('$v(x) = (x_{2}, x_{2} - x_{1})^{T}$', 'interpreter', 'latex');
set(t, 'FontSize', 16);

[X, Y] = meshgrid(0:0.1:1);
U = zeros(size(X));
V = zeros(size(Y));

for i = 1:size(X, 1)
for j = 1:size(X, 2)
    x = X(i, j);
    y = Y(i, j);
    U(i, j) = y;
    V(i, j) = y - x;
end
end

hold on;
grid on;
quiver(X, Y, U, V);

t = 0:0.05:1;
plot(t, t.^2, 'r');
axis([0 1.1 -0.1 1.1]);

xlabel('x_{1}');
ylabel('x_{2}');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
subplot(1, 3, 3);

t = title('$v(x) = (x_{2}, x_{1} - x_{2})^{T}$', 'interpreter', 'latex');
set(t, 'FontSize', 16);

[X, Y] = meshgrid(0:0.1:1);
U = zeros(size(X));
V = zeros(size(Y));

for i = 1:size(X, 1)
for j = 1:size(X, 2)
    x = X(i, j);
    y = Y(i, j);
    U(i, j) = y;
    V(i, j) = x - y;
end
end

hold on;
grid on;
quiver(X, Y, U, V);

t = 0:0.05:1;
plot(ones(size(t)), t.^2, 'r');
axis([0 1.1 -0.1 1.1]);

xlabel('x_{1}');
ylabel('x_{2}');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%