Question: modify the code to plot the graphs for the attached problem. Here is my code. Please if you do not know how to do this

modify the code to plot the graphs for the attached problem.
Here is my code. Please if you do not know how to do this please give it to someone else. Ive wasted three expert questions now. Here is my code I have:
% 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=wxmin & X 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 ***************
xlabel('Distance X (m) from Left side ')
ylabel(' Force (N)')
title('Diagram of Shear force ', 'color', 'b')
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 ***************
xlabel('Distance (m) from Left side ')
ylabel(' Moment (N-m)')
title('Diagram of Bending Moment ', 'color', 'b')
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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!