Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use the m-fileShearAndBending (M)to plot a shear and bending moment set of graphs. You will need to enhance the plot with labels, titles and more.

use the m-fileShearAndBending (M)to plot a shear and bending moment set of graphs. You will need to enhance the plot with labels, titles and more. The figure for sample problem 7.4 without enhancements is shown in the image.

You should add labels of important features and values. Also, add titles and axis labels including units. The place to add the labels in the script for each graph is indicated by

%****** Add Titles, Labels Etc. Here ***************

You may find other ways to improve on the graphs.

Part 1:

Insert your graph images with a description of what you did to label all items. Do not post or upload the Sample Problem code in this activity.

At a minimum, add the following:

  • Graph titles for each graph
  • Axis titles for each graph including units. Only the bottom graph needs an x-axis label.
  • Values at important points: point loads, shear levels, moments at point loads

Note: you will need to calculate some of these values. Experiment a little on other improvements.

Part 2:

Then, modify the code to plot the graphs for one of the problems in Section 7.3 from the textbook. You will upload this modified code on the next page.

Enhance the given code to completely label the plots. Modify the code to generate plots for another problem from section 7.3. Upload the new problem code on the next Canvas page. If a couple is applied to the beam at a point, subtract the couple at that point from the bending moment array before the next point as done for point loads.

Your initial posting should include the updated sample problem figure and descriptions. Assist other students in your class so that everyone fully understands how to generate shear and bending moment diagrams with MATLAB.

%% Shear and Bending Moment Plots

% Modified by :

% Date :

% Description :

% This script plots the shear and bending moment diagrams

% for Example Problem 7.4.It uses trapezoidal integration

% so values may be off a little.It could be modified

% for any number of point loads and a distributed load function.

% Note: Calculate support reactions before running this script

clear;

% Givens

% beam length range

xmin = 0;

xmax = 32;

X = linspace(xmin,xmax,201); % Set number of points here

dx = X(2)-X(1); % Distance between x points is constant

% Point loads including support reactions

% x is first column and force is second column

% negative force is downward directed

% Must be in increasing x order

PointLoads = [ 0,18; 6,-20; 14,-12; 24,26];

% A distributed load

% domain of application of the distributed load

wxmin = 24;

wxmax = 32;

% Load is a function of x, negative is downward

% This returns an array if x is an array

% The function is in last parenthesis

wLoad = @(x) (x>=wxmin & x

% www.mathworks.com/help/matlab/matlab_prog/anonymous-functions.html

% Solution

% set limits on x for plotting

extra = (xmax-xmin)*.03;

xbound = [xmin - extra,xmax + extra];

% new figure window with a name

figure('Name','Sample Problem 7.4');

clf;% Clear any old figure data

subplot(3,1,1);% Work on FBD the top of 3 axes

hold on;

% Draw a thick line for the beam

line([xmin,xmax],[0,0],'Color',[.5,.5,.5],'LineWidth',8);

% Draw vectors representing point loads

plx = PointLoads(:,1); % X locations

plf = PointLoads(:,2); % Force values

pll = length(plx);

plz = zeros(pll,1); % Array of zeros for x component of vectors

% draw the vectors

quiver(plx,plz,plz,plf,'Color','red','LineWidth',2);

% Use stem plot for distibuted load

wpts = X>=wxmin & X

xLoad = X(wpts);% extract the x points with distributed loads

% Calculate the distributed load at each x value with a load

yLoad = wLoad(xLoad);

% plot distributed load as a stem plot,

% This means distributed loads are directed away from the beam.

% Change the yLoad scale factor as desired

% Use '^' if load is upward, 'v' if load is down,

%and 'd' if load is both.

stem(xLoad,4*yLoad,'v','Color',[1,.7,.7]);

%******Add Titles, Labels Etc. Here ***************

text(24,-4,'w = -1.5 kips/ft');

xlim(xbound); % set x bonds to match on all subplots

hold off;

% Work on the middle shear plot

subplot(3,1,2); hold on;

% Draw a line at y=0

line([xmin,xmax],[0,0],'Color',[.5,.5,.5],'LineWidth',2);

shear = zeros(length(X),1); % define the shear array

ip = 1; % index into the point load array

i = 1; % index into the X array

for xx = X

% Trapezoidal Integration for distributed loads

if( i > 1 )

shear(i) = shear(i-1);

if( wpts(i) )

shear(i) = shear(i) ...

+(wLoad(X(i-1))+wLoad(X(i)))*dx/2;

end

end

% Add Point Loads when the new x passes a load point

if( ip <= length(plx) && xx >= PointLoads(ip,1) )

shear(i) = PointLoads(ip,2) + shear(i);

ip=ip+1;% Shift to the next Point Load

end

i=i+1; % Shift to the next shear index

end

plot(X,shear)

area(X,shear,'FaceColor',[.8,.9,1.0]); % Draw the shear plot

%******Add Titles, Labels Etc. Here ***************

xlim(xbound); % Set plot domain to be the same as other plots

hold off;

% Work on the bending moment plot at the bottom

subplot(3,1,3);hold on;

% Draw a baseline at y=0

line([xmin,xmax],[0,0],'Color',[.5,.5,.5],'LineWidth',2);

bending = zeros(length(X),1); % Bending Moment Array

% Trapezoidal Integration of Shear

i=1;

for xx = X

if( i > 1 )

bending(i) = bending(i-1) ...

+ (shear(i) + shear(i-1))*dx/2;

end

i=i+1;

end

% Draw bending moment plot

plot(X,bending)

area(X,bending,'FaceColor',[.8,.9,1.0]);

%******Add Titles, Labels Etc. Here ***************

xlim(xbound); % Set consistent x axis limits

% saveas(gcf,'ShearAndBending.png'); % Save as an image

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Contemporary College Physics

Authors: Edwin R Jones, Richard L Childers

3rd Edition

0072374810, 9780072374810

More Books

Students also viewed these Physics questions