clear;
clc;

% User input: (forces)
F1 = [2 2];
F2 = [1 -3];
F3 = [2 0];
F4 = [2 -1.5];

% Rearange into a matrix (best if the input data are in the matrix from the
% beginnning)
Fs = [F1; F2; F3; F4];

% Calculate the resulting force
F  = sum(Fs, 1)

%% Graphical output
% Generate origin for all radius vectors
Z = zeros(size(Fs, 1), 1);

% Open new figure, add the arrows, scale = 0 to have proportional lengths
figure('color', 'w');
quiver(Z, Z, Fs(:,1), Fs(:,2), 0, 'LineWidth', 1.5, 'Color', 'b');
hold on; % hold on allows to have more graphs in one figure
quiver(0, 0, F(1), F(2), 0, 'LineWidth', 2, 'Color', 'r');

grid on; % enable grid
% add labels, LaTeX interpreter makes it possible to typeset nice labels
xlabel('$F_x$', 'Interpreter', 'LaTeX', 'FontSize', 14);
ylabel('$F_y$', 'Interpreter', 'LaTeX', 'FontSize', 14);