clear all

[X, Y] = meshgrid(-5:0.4:5, -5:0.4:5);

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %
% %%%%%%%%%%%%% AUFGABE 1 A %%%%%%%%%%%% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %

% NICHT . VOR *, ^ OPERATIONEN VERGESSERN!
% Beispiel -> x^2 + x*y => x.^2 + x.*y

% Funktion f = [fx fy]^T
fx = % TODO
fy = % TODO

% Funktion g = [gx gy]^T
gx = % TODO
gy = % TODO

% Plot f
quiver(X, Y, fx, fy);
title("Vektorfeld von f");
xlabel("x");
ylabel("y");
xlim([-5, 5]);
ylim([-5, 5]);

% Plot g
figure;
quiver(X, Y, gx, gy);
title("Vektorfeld von g");
xlabel("x");
ylabel("y");
xlim([-5, 5]);
ylim([-5, 5]);

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %
% %%%%%%%%%%%%% AUFGABE 1 B %%%%%%%%%%%% %
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %

divf = % TODO
divg = % TODO

% Plot div(f)
figure;
contourf(X, Y, divf, 100, 'LineStyle', 'none');
title("Divergenz von f");
xlabel("x");
ylabel("y");
xlim([-5, 5]);
ylim([-5, 5]);

% plot div(g)
figure;
contourf(X, Y, divg, 100, 'LineStyle', 'none');
title("Divergenz von g");
xlabel("x");
ylabel("y");
xlim([-5, 5]);
ylim([-5, 5]);
