indeterminate beam and concrete load calculate shear force diagram and bending moment diagram and deflection in matlab
main.m
% Define properties of the beam and loadL = 5; % Length of the beamP = 10; % Load applied at the midpoint of the beamE = 200e9; % Young's Modulus of the materialI = 4e-6; % Moment of Inertia of the beama = L / 2; % Distance of load from the support% Calculate reactions at the supportsR1 = P / 2;
R2 = P / 2;
% Define x coordinatesx = 0:0.01:L;
% Calculate shear force (V) and bending moment (M) at every point xV = zeros(size(x));
M = zeros(size(x));
fori = 1:length(x)
if x(i) < a
V(i) = R1;
M(i) = R1 * x(i);
else V(i) = R1 - P;
M(i) = R1*x(i) - P*(x(i)-a);
endend% Calculate deflection (delta) at every point xdelta = zeros(size(x));
fori = 1:length(x)
delta(i) = -P*a*x(i)/(6*E*I)*(L^2-x(i)^2) + R1*x(i)^2/(2*E*I) - M(i)/(E*I);
end% Plot the shear force diagramfigure;
plot(x, V, 'b', 'LineWidth', 2);
xlabel('Position (m)');
ylabel('Shear Force (N)');
title('Shear Force Diagram');
% Plot the bending moment diagramfigure;
plot(x, M, 'r', 'LineWidth', 2);
xlabel('Position (m)');
ylabel('Bending Moment (Nm)');
title('Bending Moment Diagram');
% Plot the deflection diagramfigure;
plot(x, delta, 'g', 'LineWidth', 2);
xlabel('Position (m)');
ylabel('Deflection (m)');
title('Deflection Diagram');