- #1
skhii
- 1
- 0
Need help!Matlab programming for shear force and bending moment diagrams of a beam
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
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