%Moments calculation along beam
%Vertical forces
Oy = 1260.1; %[KN]
N1 = 210.5; %[KN]
N2 = 252.8; %[KN]
N3 = 289; %[KN]
N4 = 316.8; %[KN]
N5 = 191; %[KN]
%Position where the forces are implemented
x1 = 16.68; %[m]
x2 = 16.78; %[m]
x3 = 17.89; %[m]
x4 = 16.93; %[m]
x5 = 17.15; %[m]
x6 = 0.936; %[m]
%Moment at start position
Mo = -64758.212; %[KNm]
%Calculation
for x=0:0.1:85.43
if x == 0
M = Mo;
elseif x <= x1
M = Mo + Oy*x;
elseif x1 < x <= (x1+x2)
M = Mo + Oy * x - N1*x1;
elseif (x1+x2) < x <= (x1+x2+x3)
M = Mo + Oy*x - N1*(x1+x2) - N2*x2;
elseif (x1+x2+x3) < x <= (x1+x2+x3+x4)
M = Mo + Oy*x - N1*(x1+x2+x3) - N2*(x2+x3) - N3*x3;
elseif (x1+x2+x3+x4) < x <= (x1+x2+x3+x4+x5)
M = Mo + Oy*x - N1*(x1+x2+x3+x4) - N2*(x2+x3+x4) - N3*(x3+x4) - N4*x4;
end
end