Tuesday, January 22, 2013

Problem 1.4-8 of "Mechanics of Materials" by Craig


This program shows how to produce the diagrams of shearing force and
bending moment for a horizontal beam, as shown in problem 1.4-8 of the
textbook "Mechanics of Materials", 2nd. ed, by Craig.

We used values of W=10K N for the force applied at the right end of the beam,
and L = 4 m for the total beam length.
________________________________________________________________________
% Ricardo E. Avila Montoya, Jan. 21, 2013

% Matlab solution for problem 1.4-8, Craig's textbook
% Initial solution, as stated in the textbook, without calculation
% of displacements along the beam (elastic curve).

% A beam of length L is supported by a sloping cable at its mid point,
% and by a pin at its left end. A weight W is hung from the right
% end of the beam.

clc
clear

% Input section
disp('Solution of Problem 1.4-8, Craig''s textbook')
disp(' ')
W = input('Load W applied on the right end of the beam: ')
L = input('Total length of the beam: ')

% The reactions at the supports, as calculated from static equilibrium.
% Positive forces go up or right. Negative forces go down or left.
Bx = 8*W/3;     % Left end of beam, horizontal force
By = -W;        % Left end of beam, vertical force
Dx = -8*W/3;    % Mid point of beam, horizontal force applied by cable
Dy = 2*W;       % Mid point of beam, vertical force applied by cable

% Define a vector of coordinates along the length of the beam
% using 400 points as increments of the x coordinate
x = (0 : L/400 : L)'; % a column vector

% Initialize variables for shear force (V) and bending moment (M)
V = zeros(size(x,1),1);
M = V;

% Calculate values for shear forces and bending moments
for i = 1 : size(x,1)
    V(i) = By;
    M(i) = By * x(i);
    if x(i) > L/2; % For points past the middle of the beam length
        V(i) = V(i) + Dy;
        M(i) = M(i) + Dy * (x(i) - L/2);
    end
end

% Output section of program
figure(1);
plot(x, V);
xlabel('x, distance')
ylabel('V(x), shear force')
title('Diagram of shear force')
grid

figure(2);
plot(x, M);
xlabel('x, distance')
ylabel('M(x), bending moment ')
title('Diagram of bending moment')
grid

disp(' ')
disp('*******************************')
disp('Successful execution of program')

No comments:

Post a Comment