Matlab Programming for Shear Force & Bending Moment Diagrams of a Beam

In summary, your code needs to be corrected in terms of plotting the shear force diagrams, adding them together, integrating to produce the bending moment diagram, and saving the data to the LoadingData.csv file.
  • #1
skhii
1
0
Need help!Matlab programming for shear force and bending moment diagrams of a beam

Homework Statement


A program is required that will calculate the shear force and bending moment diagrams for a
cantilevered beam of arbitrary length. The loads may be point loads or distributed loads,or a combination of the two, but no moments will be directly applied to the beam.

The user will be required to specify the length of the cantilevered beam from the wall in metres.The user will then be required to indicate if the loads applied to the beam are only point loads,only distributed loads or a combination of constant distributed and point loads. Based on this input, they will then be required to select either one or two .xlsx files containing the specification of the applied loads. The calculated shear force and bending moment diagrams must then be presented to the user. If the user wishes to, they must be allowed to enter axis labels and a legend for each of these and then save these diagrams. Once the figures have been closed, the shear force and bending moment data must be saved to LoadingData.csv in the same directory as the input point force data (or distributed data if no point loads are applied) which must contain the distance along the beam in metres, with a minimum resolution of 1 mm, in the first column, the shear force in Newtons in the second column and the bending moment in Newton-metres in the third column. At the same time, the reaction shear force and moment at the wall must be displayed to the user. All distances must be given in the reference frame shown in the figure above and all forces will be given according to the indicated notation. In the point load input files, there will be two columns of data. The first column will contain the distance from the wall in metres at which the load (in Newtons) indicated in the second column is applied. Similarly, the distributed load input files will contain data in three columns of data. The first two columns will give the limits in metres from the wall, in no particular order, between which the distributed load is applied. The constant value of the distributed load, 2 in Newtons per metre, will be given in the third column. In both cases there is no limit to the number of loads (i.e. rows of data) which may be applied. If the files contain a load which is applied beyond the end of the beam, the program must ignore that load entirely. The shear force diagram can be calculated by determining the shear force diagram for each of the applied loads and ’adding’ all of these diagrams together (the principle of superposition). Once the shear force diagram is known, the bending moment diagram can be determined by integrating the shear force diagram from the free end to the beam support (since the bending moment at the free end must be zero).
A simple method of integrating the shear force diagram to produce the bending moment diagram is the trapezoidal method. must be via GUIs. Bonus marks, up to a maximum of 10%, are allowed for features that make the program more generically applicable, flexible or decidedly robust


2.


3. So far I am trynig to plot the shear force diagram for the beam experiencing only point loads.My graph is incorrent and I would really appreciate if someone would correct the code I have so far.Here is my code so far:

L=inputdlg('please enter beam length');

Q=questdlg('what types of loads are applied to the beam?', ...
'types of loads', ...
'point loads only','distributed loads only','combination','combination');
switch Q
case'point loads only'
B=xlsread(uigetfile('*.xlsx'));
V=B(:,2);% point loads
X=B(:,1);%position of point loads along beam

shear=-(sum(V));%shear1=reaction force at root of beam


for n=(0:0.01:L);
if x1<=X(1)
shear1(n<=X(1))=shear;
else
shear1=0;
end

if X(1)<n<=X(2);
shear2=shear1+V(1);
else
shear2=0;
end
if X(2)<n<X(3);
shear3=shear2+V(2);
else
shear3=0;
end
if X(3)<n<=L
shear4=shear3+V(3);
else
shear4=0;
end
end
plot(n,shear1,n,shear2,n,shear3,n,shear4)


















end
 
Physics news on Phys.org
  • #2
Homework EquationsThe shear force diagram can be calculated by determining the shear force diagram for each of the applied loads and ’adding’ all of these diagrams together (the principle of superposition). Once the shear force diagram is known, the bending moment diagram can be determined by integrating the shear force diagram from the free end to the beam support (since the bending moment at the free end must be zero). A simple method of integrating the shear force diagram to produce the bending moment diagram is the trapezoidal method. The Attempt at a SolutionYour code is incorrect in some ways. Firstly, you are not plotting the correct shear force diagrams for each of the applied loads. Secondly, you are not correctly adding them together using the principle of superposition. You need to loop through each of the applied loads and add their shear forces together. Thirdly, you are not integrating the shear force diagram correctly to produce the bending moment diagram. You should use the trapezoidal rule for integration, which requires you to calculate the area of each trapezoid using the formula A = (b+a)*h/2, where a and b are the x-coordinates of the two points defining the trapezoid, and h is the difference between the y-coordinates of the two points. Finally, you are not saving the shear force and bending moment data correctly to the LoadingData.csv file. You should use the MATLAB csvwrite() or dlmwrite() functions to save the data in the desired format.
 

1. What is Matlab programming and why is it useful for shear force and bending moment diagrams of a beam?

Matlab is a programming language and software used for numerical computation, data analysis, and visualization. It is useful for shear force and bending moment diagrams of a beam because it allows for efficient and accurate calculations and graphical representations.

2. How does Matlab programming help in understanding the behavior of a beam?

Matlab programming allows for the creation of mathematical models and simulations that can accurately predict the behavior of a beam under different loading conditions. This helps in understanding the stresses and deformations that occur in a beam.

3. Can Matlab programming be used for any type of beam?

Yes, Matlab programming can be used for any type of beam, including simple beams, cantilever beams, and continuous beams. It is a versatile tool that can handle different geometries and loading conditions.

4. How does Matlab programming generate shear force and bending moment diagrams?

Matlab programming uses mathematical equations and algorithms to calculate the shear force and bending moment at different points along a beam. These values are then plotted on a graph to create the shear force and bending moment diagrams.

5. Is Matlab programming difficult to learn for creating shear force and bending moment diagrams?

It depends on the individual's prior programming experience. For those with no programming background, it may take some time to learn the syntax and functions of Matlab. However, there are many online resources and tutorials available to help in learning and applying Matlab programming for creating shear force and bending moment diagrams.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
2
Views
839
  • Engineering and Comp Sci Homework Help
Replies
2
Views
895
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
4
Views
960
  • Engineering and Comp Sci Homework Help
Replies
1
Views
734
  • Engineering and Comp Sci Homework Help
Replies
5
Views
928
  • Engineering and Comp Sci Homework Help
Replies
2
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
16
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
8
Views
2K
Back
Top