% Linear system arising from static ideal truss model, see Sayir/Dual/Kaufmann
% "Ingenieurmechanik I", Vieweg/Teubner 2008, Fig 11.6

% Describe sparse matrix in (indexpair, entry) format,see MATLAB's sparse command
g = 0.5*sqrt(3); h = 0.5;
data = ...
    [1 1 1;1 5 1;1 6 h;...
     2 2 1;2 6 g;...
     3 3 1;3 13 -h;3 14 -1;...
     4 4 1;4 13 g;...
     5 8 -1;5 9 -h; 5 10 h;5 11 1;...
     6 9 -g;6 10 -g;...
     7 6 -h;7 7 h;7 8 1;...
     8 6 -g; 8 7 -g;...
     9 5 -1; 9 7 -h; 9 9 h;...
     10 7 g;10 9 g;...
     11 10 -h; 11 12 h;11 14 1;...
     12 10 g; 12 12 g;...
     13 11 -1; 13 12 -h; 13 13 h;...
     14 12 -g; 14 13 -g];

% Right hand side force vector
b = zeros(14,1); b(8) = 1; b(13) = 2*g;

% Create sparse matrix
A = sparse(data(:,1),data(:,2),data(:,3));

% Print matrix. Note that the columns corresponding to the fixed supports have
% been added to the left.
disp(full(A)); b,
