plotTruss.m
function plotTruss(axes, truss)
% zeichnet das Fachwerk truss
xp = truss.x0(1,:);
yp = truss.x0(2,:);
M = length(xp);
% zeichne Knoten
plot(axes, xp, yp, "ko")
axis(axes, [-0.5 3.5 -1.5 2.5])
set(axes, "XTick", [], "YTick", [])
% zeichne Verbindungen
hold(axes, "on")
for I=1:M
for J = 1:(I-1)
if truss.A(I,J) ~= 0
plot(axes, [xp(I) xp(J)], [yp(I) yp(J)], "k-")
end
end
end
% markiere fixierte Knoten
for I=truss.N+1:M
plotSquare(axes, xp(I), yp(I))
end
hold(axes, "off")
% mache Achsensystem quadratisch
axis(axes, "equal")
%--------------------------------------------------------------------
function plotSquare(axes, x, y)
% zeichnet ein kleines rotes Rechteck um (x,y)
d = 0.2;
xi = [x-d, x+d, x+d, x-d, x-d];
yi = [y+d, y+d, y-d, y-d, y+d];
plot(axes, xi, yi, "r-")