×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

MatLab Beam Shear force diagram and Bending Moment Diagram

MatLab Beam Shear force diagram and Bending Moment Diagram

MatLab Beam Shear force diagram and Bending Moment Diagram

(OP)
Hi all,

My final year civil engineering assignment requires me to use matlab and create a shear force and bending moment diagrams for a simply supported beam. The only problem we can't coded it properly. The question is below

"You are required to create a script file in Matlab capable of calculating the key values and plotting a
load diagram; shear force diagram and a bending moment diagram for a simply supported beam
subjected to any combination of a uniformly distributed load along its entire length and up to 2 point
loads within the span.
The user should be able to input the beam span, the value of the UDL, the value and position of each
of the point loads. The user may also input the no. of intervals along the beam or the size of the
intervals along the beam for calculating the shear force and bending moment values."


That's the code i managed to write so far, but it does not work as it should,

PLEASE HELP !!!!!!!!!!!!!!!!!!!!!!!!!

http://files.engineering.com/getfile.aspx?folder=7...

clear all; clc

%Step 1 - User Input%
Span = 10;
UDL = 5;
P1 = 15;
PL1 = 2;
P2 = 10;
PL2 = 6

c = Span-PL1

%Step - Calculate Beam end Reactions
R1 = ((P1*(Span-PL1))+(P2*(Span-PL2))+(UDL*Span*(Span/2)))/Span %Left Support Reaction
R2 = ((P1*PL1)+(P2*PL2)+(UDL*Span*(Span/2)))/Span %Right Support Reaction

%Discretization of x axis

n = 20; %Number of discretization of x-axis.
delta_x=Span/n; %Increment for discretization of x-axis.
x = (0:delta_x:Span); %Generate column array for x-axis.

SF = zeros(size(x,1),1); %Shear force function of x.
BM = zeros(size(x,1),1); %Bending Moment function of x.



for ii=1:n+1
%First portion of the beam, 0<x<
if x(ii)<=PL1;
SF(ii) = R1-(UDL*delta_x*(ii-1));
BM(ii) = R1*x(ii);
SFO(ii)=0;
elseif x(ii)>=Span&&x(ii)<PL1;
SF(ii) = R1-(UDL*PL1)-P1;
SFO(ii) = 0;
elseif x(ii)>PL1;
SF(ii) = R1-(UDL*delta_x*(ii-1))-P1
SFO(ii) = 0;
elseif x(ii)>PL1;
SF(ii) = R1-(UDL*delta_x*(ii-1))-P1
SFO(ii) = 0;
end
end





%SHEAR FORCE CALCULATION

subplot(3,1,1)
plot(x,UDL,'b.-')
grid
title('Span of the Beam')
xlabel('Span (m)') %x-axis label
ylabel('UDL (kN/m)') %y-axis label

subplot(3,1,2)
plot(x,SF,'m',x,SFO,'b','linewidth',1.5)
grid
title('Shear Force Diagram')
xlabel('Span (m)') %x-axis label
ylabel('Shear Force (kN)') %y-axis label

subplot(3,1,3)
plot(x,BM,'m',x,BMO,'b','linewidth',1.5)
grid
title('Bending Moment Diagram')
xlabel('Span (m)') %x-axis label
ylabel('Bending Moment (kN-m)') %y-axis label


RE: MatLab Beam Shear force diagram and Bending Moment Diagram

Not a MatLab guy - practicing engineer, so Mathcad was always my choice.

But what is the point of the exercise? To show proficiency in MatLab or to show that you understand the basic theory behind beam bending?

I think I understand the code as written, except of the "discretization of the X-axis" part. Are you arbitrarily dividing the beam into 20 segments? Why? Is that necessary to report forces at each segment?

I think I'd look there first. Are you sure you're able to correctly compute the internal beam forces in those locations the way you have it set up? Because that seems like a lot of work to so something a bit more simply. If it were me, I think I'd have it report the forces at each location of a point-load, and connect the force diagram curves between them. Is "Pn" the magnitude and "PLn" the location of the point loads? Just compute the forces at those points; the rest is simple algebra.

"No one is completely useless. He can always serve as a bad example." --My Dad ca. 1975

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources