multispan beams · to the distribution of the load and not to the magnitude. the maximum magnitude...
TRANSCRIPT
MULTISPAN BEAMS Computing Project 5
Michael Kasner 4-3-19
Introduction
This report studies the state variables of a multi-span beam to different loading
conditions. The relationships between the load and the state variables are studied using a
MATLAB program which takes the input loading scenario and solves and plots the internal
reactions over the spans of the beam. A sample loading case from the assignment guide is shown
in Figure 1. The figure demonstrates a case where the load is different on each span of the beam
and the code accounts for this change. The program also can analyze any load that can be defined
by a function. There are 6 load functions in the directory of this program and these are listed in
Table 1.
Figure 1. Diagram of a Multi-Span Beam
To explain how the program works, this report begins by describing the theory behind the
set of differential equations that define the internal reactions in the beam. Through the theory, the
equations for shear, moment, rotation and displacement are derived and explained. The accuracy
of the code is proved through the benchmark and by verifying that the response quantities for the
state variables are continuous at the supports. Finally, in the study section, the problem will be
explored through changing the ends of the multi-span beam to either fixed, simple, or free, and
the effects on the four spans of the beam will be observed.
MATLAB helps study these scenarios by allowing the user of this program to quickly
and easily compute the results for various boundary conditions and loading cases. The
computations performed by the program would take much longer by hand and would be
susceptible to mistakes. Likewise, the plots generated by the code can be formatted and changed
easily and rendered in much higher quality than is possible by hand.
Theory
The theory section will cover five major sections. The first section lists the load cases that
can be applied to the beam. The second section defines the internal responses of the beam to the
load. The third section simplifies the response equations. The fourth section relates the boundary
conditions and the state variables. Finally, the fifth section shows how the system of equations is
solved using matrix algebra.
Load Cases
The beam can be loaded with a variety of load types. The load functions in Table 1 define
the way the load is distributed across the length of the beam. In the six equations below, 𝑞 is the
magnitude of the load at any point, 𝑥 is the position along the beam that the load is evaluated and
𝐿 is the total length of the beam. For type 5, the patch load, the load is a piecewise function
where the load begins at 𝑥𝑠𝑡𝑎𝑟𝑡 and ends at 𝑥𝑒𝑛𝑑.
Table 1. Functions of each Load Condition
Load Type Load Equation
1. Constant 𝑞 = 1
2. Ramp up 𝑞 =𝑥
𝐿
3. Ramp down 𝑞 = 1 −𝑥
2
4. Sinusoidal 𝑞 = sin (𝜋𝑥
𝐿)
5. Patch load 0 < 𝑥 < 𝑥𝑠𝑡𝑎𝑟𝑡 𝑞 = 0
𝑥𝑠𝑡𝑎𝑟𝑡 < 𝑥 ≤ 𝑥𝑒𝑛𝑑 𝑞 = 1
𝑥𝑒𝑛𝑑 < 𝑥 ≤ 𝐿 𝑞 = 0
6. Trapezoidal 𝑞 =
𝑥
2𝐿+
1
2
The program takes these load functions to analyze each respective condition. These refer
to the distribution of the load and not to the magnitude. The maximum magnitude is set in the
program and is multiplied to the load functions above to get the true load at the specified
position.
Internal Beam Responses
The internal responses of the beam to the applied load, q, that are discussed in this report
are shear: V, moment: 𝑀, rotation: 𝜃, and deflection: 𝑤. These responses are called state
variables. Figure 2 shows the beam in its undeformed and deformed shape and physical
properties associated with each of the state variables.
Figure 2. Deformed and Undeformed Beam and the Physical Properties of the State Variables
Each of these properties are integrals of each other. Moment is the integral of shear.
Rotation is the integral of moment. Deflection is the integral of rotation. Equations 1-4 show
these relationships.
𝑑𝑉
𝑑𝑥 + q = 0 (1)
𝑑𝑀
𝑑𝑥 - V = 0 (2)
𝑑𝜃
𝑑𝑥 -
𝑀
𝐸𝐼 = 0 (3)
𝑑𝑤
𝑑𝑥 + 𝜃 = 0 (4)
The values of these internal reactions are determined by the differential of the previous
function and the values of the boundary conditions. Each type of possible support for a beam will
give two known boundary conditions. Figure 3 shows four types of supports and the associated
knowns for each.
Figure 3. Support Types and Associated Boundary Conditions
The boundary conditions are critical to solving the problem because they give knowns to
use to solve the set of differential equations.
There are four equations used to determine the value of the responses at any point along
the beam once the boundary conditions are found. The first, Equation 5, shows the formula for
shear using the known shearing at length 𝑥 = 0. In this equation, as well as Equations 6-8, 𝜉 is the
spatial variable for length integrated over to find the sum of the response over the entire beam. 𝑞
is the load function, and 𝑥 is the independent valuable for the distance along the beam at which
the internal response is found.
𝑉(𝑥) = 𝑉0 − ∫ 𝑞(𝜉) ⅆ𝜉𝑥
0 (5)
Equation 6 is the formula for finding the moment at any point along the beam. Note that
this equation uses the boundary conditions for the moment and the shear.
𝑀(𝑥) = 𝑀0 + 𝑉0𝑥 − ∫ (𝑥 − 𝜉)𝑞(𝜉) ⅆ𝜉𝑥
0 (6)
Equation 7 is the formula for finding the rotation of the beam at any point. This equation
uses the boundary conditions for the moment, shear and rotation. Moment and shear depend only
on the forces and moments applied to the beam. Rotation and deflection are the result of these
loads but also depend on the properties of the material, size and shape of the beam. To
incorporate these new factors, the terms using load, shear and moments must be divided by 𝐸
and 𝐼. 𝐸 is Young’s modulus for the material of the beam and 𝐼 is the moment of inertia of the
beam about the neutral axis.
𝜃(𝑥) = 𝜃0 +𝑀0𝑥
𝐸𝐼+
𝑉0𝑥2
2𝐸𝐼−
1
2𝐸𝐼∫ (𝑥 − 𝜉)2𝑞(𝜉) ⅆ𝜉
𝑥
0 (7)
Equation 8 is the formula for finding the deflection of the beam at any point. This
equation uses the same boundary conditions as rotation with the addition of deflection.
𝑤(𝑥) = 𝑤0 − 𝜃0𝑥 −𝑀0𝑥2
2𝐸𝐼−
𝑉0𝑥3
6𝐸𝐼+
1
6𝐸𝐼∫ (𝑥 − 𝜉)3𝑞(𝜉) ⅆ𝜉
𝑥
0 (8)
For the equations above, the value of the response does not need to be known at a known
𝑥 = 0 to find the equation for that response. The value at the far end, or a location in the middle
of the beam is enough to determine to complete formula for that response. The formulas are
applicable to any point on the beam, including the ends. To find the values at the left and right
ends of the beam, the variable 𝑥 will be set to 0 and L respectively.
Simplified Response Equations
The internal responses of the beam are the result of the supports and the load. The
portion of the response caused by the distributed load is the term in Equations 5-8 with the
integral. The total response caused by the load over the whole beam is found by taking this term
and integrating over the total length. These terms are each assigned to a variable. Equation 9 sets
𝐼0 equal to the sum for shear.
𝐼0 = ∫ 𝑞(𝜉) ⅆ𝜉𝐿
0 (9)
Equation 10 sets 𝐼1 equal to the sum for moment.
𝐼1 =1
𝐸𝐼∫ (𝐿 − 𝜉)𝑞(𝜉) ⅆ𝜉
𝐿
0 (10)
Equation 11 sets 𝐼2 equal to the sum for rotation.
𝐼2 =1
2𝐸𝐼∫ (𝐿 − 𝜉)2𝑞(𝜉) ⅆ𝜉
𝐿
0 (11)
Equation 12 sets 𝐼3 equal to the sum for deflection.
𝐼3 =1
6𝐸𝐼∫ (𝐿 − 𝜉)3𝑞(𝜉) ⅆ𝜉
𝐿
0 (12)
Boundary Conditions and State Variables
The state variables are the internal responses of the beam. The values of the state
variables depend on the type of support on the ends of the beam. Figure 2 shows the known state
variables for each type of support. These equations state mathematically that the difference in the
boundary conditions must equal the change in those state variables over the length of the beam.
Equation 13 shows this formula for shear. Equation 14 shows this formula for moment.
Equation 15 shows this formula for rotation, and Equation 16 shows this formula for deflection.
𝑉0 − 𝑉𝐿 = 𝐼0 (13)
𝑀0 − 𝑉𝐿 + 𝑉0𝐿 = 𝐼1 (14)
𝜃0 − 𝜃𝐿 +𝑀0𝐿
𝐸𝐼+
𝑉0𝐿2
2𝐸𝐼= 𝐼2 (15)
𝑤0 − 𝑤𝐿 − 𝜃0𝐿 −𝑀0𝐿2
2𝐸𝐼−
𝑉0𝐿3
6𝐸𝐼= −𝐼3 (16)
Matrix Algebra
The system of the Equations 13-16 can be placed in a matrix. The four identities in
Equation 17 help simplify this matrix.
𝑎 = 𝐿, 𝑏 = 𝐿
𝐸𝐼, 𝑐 =
𝐿2
2𝐸𝐼, ⅆ =
𝐿3
6𝐸𝐼 (17)
The identities simplify the coefficients in the system. A is the matrix with all the
coefficients of the terms in the system and this is shown in Equation 18.
A=[
1 0 0 0𝑎 1 0 0𝑐
−ⅆ𝑏
−𝑐1 0−𝑎 1
] (18)
The complete set of matrices that represent the system is shown in Equation 19. The
system is solved iteratively using the General Trapezoidal Rule and Newton’s Method of
Integration.
[
1 0 0 0𝑎 1 0 0𝑐
−ⅆ𝑏
−𝑐1 0−𝑎 1
] {
𝑉0
𝑀0
𝜃0
𝑤0
} − {
𝑉𝐿
𝑀𝐿
𝜃𝐿
𝑤𝐿
} = {
𝐼0
𝐼1
𝐼2
−𝐼3
} (19)
Code Verification
This program met the benchmark in class. This verification compares the plots from the
benchmark to the plots generated by the program for the benchmark case. Figure 4 shows the
program results on the left and the benchmark plots on the right.
Figure 4. Benchmark Case Results (right) and the Given Benchmark Solution (left)
In Figure 4, The shape of the plots from the program matches the shape of the benchmark
plots. This is evidence that the code is properly analyzing the system.
The second form of verification is a test of the logical assumption that the moment,
rotation and deflection plots must be continuous for a continuous beam. The verification will
consist of four test cases. If the functions for the three state variables are continuous, this will be
further evidence that the code is working properly. Figures 5 and 6 show the four test cases. The
first plot is the load. This is an input for the program and is assigned randomly for these cases.
The next three plots are, in order: moment, rotation and deflection.
Figure 5. Plots for Continuity Tests 1 and 2
Figure 6. Plots for Continuity Tests 3 and 4
The curves for all three state variables are continuous over the length of the beam. The
load shapes and magnitude were selected at random and the plots behaved as expected. This,
along with the benchmark shows strong evidence that the program analyzes this system
accurately.
Study
The study analyzes two civil engineering problems. The first section examines the effect
of the type of support on the shear, moment and deflection of the beam using a variety of load
cases. The second explores how the stiffness of the beam changes the deflection of the individual
spans of the beam.
State Variables and Support Types
The loading for case 1 is shown in Figure 7. Table 2 shows the load type and the
magnitudes for each section of the beam.
Figure 7. Shear and Moment from the Given Solution
Table 2. Loading Scenario for Case 1
Segment 1 Segment 2 Segment 3 Segment 4
Sinusoidal Sinusoidal Sinusoidal Sinusoidal
q = 2 q = 2 q = 2 q = 2
Table 3 compares the plots of the shear, moment and deflection for six combinations of
boundary conditions. The connections in the center of the beams is the same throughout.
Table 3. Comparison of the Effect of Different Support Types on the State Variables for the
Loading Case 1
Types Shear Moment Deflection
Fixed
- - - - -
Fixed
Simple
- - - - -
Simple
Free
- - - - -
Free
Fixed
- - - - -
Simple
Fixed
- - - - -
Free
Simple
- - - - -
Free
The plots in Table 3 show several trends. First, the least variation in the shear, moment
and deflection is associated with fixed supports. The couple moment provided by fixed supports
allows the moment and shear plots to be balanced about the x-axis. The deflection plot is the
same for each span.
The simple support is associated with skewed shear, moment and deflection plots. The
moment for the span adjacent to the simple support reaches a maximum double that of the fixed
support cases or the spans in the center of the beam. The shear plot has roughly the same shape
as before but with slight variations in maximums at the supports. The deflection plot shows a
maximum deflection for the end spans more than double that of the previous case or the middle
spans. The lack of couple moment in the simple support causes these surprising trends.
The free support, used in a cantilever, causes the greatest shear, moment and deflection of
all support types. There is no support on the ends and this forces the center supports to pick up
the slack. The maximum shear is double that of the fixed support case and this value is found on
either side of the support. The maximum moment is at the supports as well and is 4 times the
moment of the simple support case. The maximum deflection is 25 times that of the simple
support case and 75 times that of the fixed case. This trend shows that the cantilever design
places the most stress on the beam.
The last three cases are combinations of fixed, simple and free support cases. The plots
for the three variables can be split in half for these three cases. The plots for each half of the
beam match the plots for that support case from the first three cases. For example, the right half
of the plots for case six match with all other cases with a free end. The left half of the plots for
the same case matches all other set of plots for a simply supported end.
The loading on the beam affects the plots. The first loading case was symmetrical, and
this made the trends in the data easy to spot. To test the effect of different loading scenarios on
the trends shown above, three different loading scenarios are tested. The next scenario is load
case 2, in which the load doubles in magnitude for each span from left to right. Figure 8 shows
the second loading scenario. Table 4 shows the load types and magnitudes on each span.
Figure 8. Shear and Moment from the Given Solution
Table 4. Loading Scenario for Case 2
Segment 1 Segment 2 Segment 3 Segment 4
Sinusoidal Sinusoidal Sinusoidal Sinusoidal
q = 2 q = 4 q = 8 q = 16
Table 5 compares the plots of the shear, moment and deflection for six combinations of
boundary conditions. The connections in the center of the beams is the same throughout.
Table 5. Comparison of the Effect of Different Support Types on the State Variables for the
Loading Case 2
Types Shear Moment Deflection
Fixed
- - - - -
Fixed
Simple
- - - - -
Simple
Free
- - - - -
Free
Fixed
- - - - -
Simple
Fixed
- - - - -
Free
Simple
- - - - -
Free
The plots for the fixed-fixed show the same patterns as the evenly loaded case except that
the shapes are stretched to double the size with each new span of the beam. The simple-simple
case shows the same skewing in the data as shown in the first loading case. The deflection plot
shows that the beam deflects up for span adjacent to the span with the largest load. The
difference in load causes the beam to bow up to compensate for the uneven load. The free-free
support case causes a 5-fold increase over the simple-simple case in the maximum moment
experienced by the beam. The deflection over the last span of the beam increases by a factor of
14 from the simple-simple case. This shows the continuation of the trend that the cantilever
configuration creates the most stress on the beam.
As before, the halves of the plot match the general shape for their respective support
cases. The only difference is that the right half of the beam is loaded much more than the left.
This causes the pattern created by the support on the right side to dominate the shape of the
entire plot.
The loading for case 3 is shown in Figure 9. Table 6 shows the load type and the magnitudes for
each section of the beam. In this load case, the load is applied only on the middle spans of the
beam.
Figure 9. Shear and Moment from the Given Solution
Table 6. Loading Scenario for Case 3
Segment 1 Segment 2 Segment 3 Segment 4
No Load Sinusoidal Sinusoidal No Load
q = 0 q = 2 q = 2 q = 0
Table 7 compares the plots of the shear, moment and deflection for six combinations of
boundary conditions. The connections in the center of the beams is the same throughout.
Table 7. Comparison of the Effect of Different Support Types on the State Variables for the
Loading Case 3
Types Shear Moment Deflection
Fixed
- - - - -
Fixed
Simple
- - - - -
Simple
Free
- - - - -
Free
Fixed
- - - - -
Simple
Fixed
- - - - -
Free
Simple
- - - - -
Free
The plots in Table 7 show the affect that no load has on the plots. The shear over the
unloaded sections is constant in all support cases. The moment plots change linearly over the
unloaded sections for fixed and simple supported ends and are 0 over the unloaded section
adjacent to a free support. There are patterns that are caused by the type of support on that end of
the beam. The maximum shear and moment vary by only 25%. The deflection varies 4 times as
much for the free end cases than for fixed and simple supports. The maximum deflection of the
beams is on the free end and this deflection is up.
The loading for case 4 is shown in Figure 10. Table 8 shows the load type and the
magnitudes for each section of the beam. This loading case will consist of loads only on the end
spans of the beam.
Figure 10. Shear and Moment from the Given Solution
Table 8. Loading Scenario for Case 4
Segment 1 Segment 2 Segment 3 Segment 4
Sinusoidal No Load No Load Sinusoidal
q = 2 q = 0 q = 0 q = 2
Table 9 compares the plots of the shear, moment and deflection for six combinations of
boundary conditions. The connections in the center of the beams is the same throughout.
Table 9. Comparison of the Effect of Different Support Types on the State Variables for the
Loading Case 4
Types Shear Moment Deflection
Fixed
- - - - -
Fixed
Simple
- - - - -
Simple
Free
- - - - -
Free
Fixed
- - - - -
Simple
Fixed
- - - - -
Free
Simple
- - - - -
Free
The plots in Table 9 repeat many patterns from the third load case. The shear is constant
over the unloaded section of the beam. The moment changes linearly over these same sections.
As before, the free supports cause the greatest shear, moment and deflection in the beam. The
plots for the symmetrical supports can be cut in half and pieced together to form the plots for the
imbalanced support cases. As with the previous load case, the unloaded section of the beam
deflected upwards.
The Effect of Stiffness on Deflection
Young’s Modulus and the Moment of Inertia are properties of the beam that affect the
ratio between the load and the deflection. This section of the study will examine how the
assigned value for these properties changes the deflection in a stepped load case. The only
variable that will change is the stiffness, EI. The load, shear, and moment plots for this series of
tests are shown in Table 10.
Table 10. Load, Shear and Moment plots for the Stiffness Tests
Support
Types
Load Plot Shear Plot
Moment Plot
Fixed
- - - - -
Fixed
The loading conditions will be the same throughout the stiffness tests. The load is applied
in a sinusoidal shape with the maximum load doubling for each successive span. The shear and
moment plots will remain the same is all cases. Table 11 displays the deflection plots for all 5
Stiffness Tests. The first three tests will have equal stiffness for each span of the beam. All the
spans will start with a stiffness of EI equal to 100 in the first test, 200 in the second test and 400
in the third test. The last two tests will have stiffnesses varying for each span. The fourth test will
have stiffness doubling with each subsequent span and the fifth test will have the stiffness
halving with each successive span.
Table 11. Deflection Plots for 5 Stiffness Tests
Stiffnesses (EI) for Spans [1,2,3,4] Deflection Plot
[100, 100, 100, 100]
[200, 200, 200, 200]
[400, 400, 400, 400]
[200, 400, 800, 1600]
[1600, 800, 400, 200]
The shape of the deflection plots does not change over the first 3 tests. The magnitude of
the deflection is halved each time. This matches the expectation that doubling the stiffness will
halve the deflection. The fourth test shows a case where the load and the stiffness double for
each new section of the beam. The expectation was that the deflection would be the same for
each span. The results show that this is roughly, but not exactly, true. The deflection of each
section affects the deflection of the others. Near the connection between the first two spans and
the final two spans, the beam deflects up. This changes the maximum deflection for that span and
causes the maximums to not be equal. The last test shows the trend that small loads and large
stiffnesses deflect much less than large loads over beams of small stiffnesses.
New Observations
Several new trends emerge in the study. The first is that a cantilever configuration paces
the greatest stress on the material. The maximum values for bending moment and shear are the
critical values that affect the design of the beam. The beam must be larger or of higher quality in
a cantilever design. To a lesser extent, simple supports place more stress on the beam than a
fixed support. To reduce the cost of the beams in a structure, fixed supports should be used
whenever possible.
The second trend to emerge is that the shape of the plots is determined by the closest
support. For example, this means that a simple-fixed supported beam will behave like a simply
supported beam on the left half and a fixed supported beam on the right half. This holds true for
symmetrical loading conditions. The trend is altered by imbalanced loads. When the load is
greater on one side of the beam, the support on that side will determine nearly the entire shape of
the plots for the state variables.
The third trend to emerge from the study is that the beam will deflect upward over lightly
loaded sections. This trend is especially true when the load on an adjacent span is heavy. The
most significant example of this is the deflection plots for cantilever beams when half the beam
supported no load. However, this also appeared in the fourth stiffness test. The expectation was
that all spans of the bar would deflect equally. This did not happen because the beam deflected
upwards where the load was relatively light which is to the left of every support. The upwards
deflection was uneven because the change in the load. Every span in this test deflected by a
different amount due to this unexpected phenomenon.
Other Aspects
This program is a basic representation of real-world beam loading scenarios. This
program does not incorporate the axial forces experienced by the beam. In addition, this code
only analyzes the bar as a one-dimensional shape. The moment of inertia of the beam is assigned
and not calculated. Adding code to solve for the inertia given the cross section of the beam
would make this program a more useful product.
Conclusion
This report studied the effect of the choice of boundary conditions on the state variables
of a multi-span beam. The theory section showed how the equations for the responses are
derived and calculated in the program. The accuracy of the code was tested through the
benchmark case and by verifying that the response quantities for the state variables were
continuous at the supports.
The first part of the study section of this report delved into the relationship between the
support used and the stress placed on the beam. The second part of the study explored the
relationship between beam stiffness and deflection. Three trends were observed during the study.
The first was that different support configurations cause different stresses in the beam. After
asserting that the bending moment and shear force are the most important values to consider in
the design of a beam, it was concluded that a cantilever configuration places the greatest stress
on a beam and should be avoided. When possible, fixed supports should be used to save cost.
The second trend discovered in this study section is that the shape of the plots is determined by
the nearest support. This conclusion holds true for symmetrical loads and is altered by
imbalanced loads. The third and final trend from the study observed that a beam will deflect
upward over lightly loaded sections. This holds especially true when the load on a nearby span
is heavily loaded. This conclusion dispels the initial assumption that maximum span deflection
is a simple calculation. In fact, many spans tested in this section deflected by a different amount
even when placed under the same load. The exploration of the problem was made possible with
the use of MATLAB software. Without this software, the calculations and rendering for this
report would take a prohibitive amount of time.
References
Keith D. Hjelmstad. CP5 Notes – Multispan Beam. CEE 213 Deformable Solids, Arizona State
University.
Appendix A
MATLAB Code
clear;clc;
%Initalization of knowns (given parameters)
%Spans 1-4
%Lengths Stiffnesses Magnitudes
L1=10; EI1=200; qo1=2;
L2=10; EI2=200; qo2=2;
L3=10; EI3=200; qo3=2;
L4=10; EI4=200; qo4=2;
type=[1,7,1,7]; %Load case
fixed = [1,1,0,0];
simple = [1,0,1,0];
slide = [1,1,1,0];
free = [0,0,1,1];
reac = [1,1,1];
BC = [simple,slide,slide,slide,simple,reac];
npts=21; %number of points
% Matrices that hold span values
nspans = 4; %number of spans
L = [L1; L2; L3; L4]; %holder of all span lengths
qo = [qo1; qo2; qo3; qo4]; %holder of all load magnitudes
EI = [EI1; EI2; EI3; EI4]; %Holder of all Stiffness constants
%Simpson Rule
for nn=1:nspans
nsimpson=21; %Simpson Segments
wt = [1,repmat([4,2],1,(npts-3)/2),4,1]; %Simpson weight
npts = length(wt); %Simpson points value
h = (L(nn)/(npts-1)); %step size
wt = wt*h/3; %Simpson weight
%integration initialization
Int0(nn) = 0;
Int1(nn) = 0;
Int2(nn) = 0;
Int3(nn) = 0;
for ii=1:npts %find value at all points
xx = (ii-1)*h; %step size based on precious point
p = qo(nn)*LoadFunctionCP5(xx,L(nn),type(nn)); %load value
Int0(nn) = Int0(nn)+wt(ii)*p; %equations for integration
Int1(nn) = Int1(nn)+wt(ii)*p*(L(nn)-xx);
Int2(nn) = Int2(nn)+wt(ii)*p*(L(nn)-xx)^2*(1/(2*EI(nn)));
Int3(nn) = Int3(nn)+wt(ii)*p*(L(nn)-xx)^3*(1/(6*EI(nn)));
end
Z = [Int0;Int1;Int2;-Int3]; %holder of integrated values
a = L(nn); %constant values
b = L(nn)/EI(nn);
c = L(nn).^2/(2*EI(nn));
d = L(nn).^3/(6*EI(nn));
A{nn} = [1, 0, 0, 0; %beam equations for each span
a, 1, 0, 0;
c, b, 1, 0;
-d,-c,-a, 1];
R{nn} = [1;a;c;-d]; %support reaction at each node
end
z = [Z(:,1);Z(:,2);Z(:,3);Z(:,4)]; %Right side of matrix
I = eye(4); %identity matrix
S0 = zeros(4); %Zeros matrix for Q
SL= zeros(4,1); %Zeros matrix for r
Q=[A{1}, -I, S0, S0, S0; %state variables for all spans
S0, A{2}, -I, S0, S0;
S0, S0, A{3}, -I, S0;
S0, S0, S0, A{4},-I];
r = [SL, SL, SL; %support reactions for all nodes
-R{2}, SL, SL;
SL, -R{3}, SL;
SL, SL, -R{4}];
B = [Q,r]; %Full system matrix (final governing matrix)
Fhat = zeros(23,1); %place holder for full result matrix
%boundary conditions [simple,slide,slide,slide,simple,free];
C=B(:,BC==1); %Reduced system matrix
F=C\z; %Unknown matrix
Fhat(BC==1)=F; %Full Result Matrix
Vold=[Fhat(1);Fhat(5)-Fhat(21); %shear force values for each node
Fhat(9)-Fhat(22);Fhat(13)-Fhat(23)];
Mold=[Fhat(2);Fhat(6); %moment values for each node
Fhat(10);Fhat(14)];
thetaold=[Fhat(3);Fhat(7); %rotation for each node
Fhat(11);Fhat(15)];
wold = [Fhat(4);Fhat(8); %transverse displacement for each node
Fhat(12);Fhat(16)];
% Reaction Force
n1 = Fhat(21); %node 1
n2 = Fhat(22); %node 2
n3 = Fhat(23); %node 3
%initalization
Nitems=6;
GTR=40;
iout = 0;
Lo = 0; %inital length
xx=0;
history=zeros(GTR*nspans,Nitems);
Beta=0.5; %Beta
for nn=1:nspans %for each span
dx=L(nn)/(GTR-1); %step size
x = 0;
p=LoadFunctionCP5(x,L(nn),type(nn))*qo(nn); %calculate load
Vp = Vold(nn); %set new values
Mp = Mold(nn);
thetap = thetaold(nn);
wp = wold(nn);
%Generalized Trapezoidial rule for numerical integration
for i=1:GTR
iout =iout +1;
history(iout,:)=[p,Vp,Mp,thetap,wp,xx+x]; %holds needed computed values at full
length
x = x + dx;
pnew = qo(nn)*LoadFunctionCP5(x,L(nn),type(nn)); %load
Vnew = Vp-dx*(Beta*p+(1-Beta)*pnew); %shear
Mnew = Mp+dx*(Beta*Vp +(1-Beta)*Vnew); %moment
thetanew = thetap +(dx/EI(nn))*(Beta*Mp+(1-Beta)*Mnew); %rotation
wnew=wp - dx*(Beta*thetap + (1-Beta)*thetanew); %transverse displacement
p = pnew; %set new values
Vp = Vnew;
Mp = Mnew;
thetap = thetanew;
wp = wnew;
end
xx = xx + L(nn);
end
%Plot figures switches
dofig1=1; %Applied load
dofig2=1; %Deflection
dofig3=1; %Rotation
dofig4=1; %Bending Moment
dofig5=1; %Net Shear Force
dofig6=0;
%. Plot the Graphs
%Applied Load
if (dofig1==1)
figure(1); clf; grid on; axis square; hold on;
xlabel('x'); ylabel('Load'); title('Applied Load');
area(history(1:iout,6),history(1:iout,1),'facecolor','cyan');
end %End dofig1
%Deflection
if (dofig2==1)
figure(2); clf; grid on; axis square; hold on;
xlabel('x'); ylabel('-w'); title('Deflection');
plot(history(1:iout,6),-history(1:iout,5),'Color','k','LineWidth',2);
end %End dofig2
%Rotation
if (dofig3==1)
figure(3); clf; grid on; axis square; hold on;
xlabel('x'); ylabel('\theta'); title('Rotation');
plot(history(1:iout,6),history(1:iout,4), 'color','red');
end %End dofig3
%Bending Moment
if (dofig4==1)
figure(4); clf; grid on; axis square; hold on;
xlabel('x'); ylabel('M'); title('Moment');
area(history(1:iout,6),history(1:iout,3),'facecolor','blue');
end %End dofig4
%Net shear force
if (dofig5==1)
figure(5); clf; grid on; axis square; hold on;
xlabel('x'); ylabel('V'); title('Shear');
area(history(1:iout,6),history(1:iout,2),'facecolor','green');
end %End dofig5
if (dofig6==1)
figure(6); clf; grid on; hold on;
subplot(4,1,1);
xlabel('x'); ylabel('Load'); title('Applied Load');
area(history(1:iout,6),history(1:iout,1),'facecolor','cyan');
%Deflection
subplot(4,1,4); grid on; hold on;
xlabel('x'); ylabel('-w'); title('Deflection');
plot(history(1:iout,6),-history(1:iout,5),'Color','k','LineWidth',2);
%Rotation
subplot(4,1,3); grid on; hold on;
xlabel('x'); ylabel('\theta'); title('Rotation');
plot(history(1:iout,6),history(1:iout,4), 'color','red');
%Bending Moment
subplot(4,1,2); grid on; hold on;
xlabel('x'); ylabel('M'); title('Moment');
area(history(1:iout,6),history(1:iout,3),'facecolor','blue');
% %Net shear force
% subplot(5,1,2); grid on; hold on;
% xlabel('x'); ylabel('V'); title('Shear');
% area(history(1:iout,6),history(1:iout,2),'facecolor','green');
end %End dofig6
%. Print values in command window
fprintf('\r%s\n', ' PHYSICAL PROPERTIES ')
fprintf('\r\r%s\n', ' END CONDITION AND LOAD CASE NUMBER ')
if BC(2)==0
fprintf('%s%8.3f\n', ' Boundary condition at x=0 : simple')
else
fprintf('%s%8.3f\n', ' Boundary condition at x=0 : fixed ')
end
if BC(18)==0
fprintf('\n%s%8.3f\n', ' Boundary condition at x=L : simple')
else
fprintf('\n%s%8.3f\n', ' Boundary condition at x=L : fixed ')
end
fprintf('\r%s\n', 'Span 1 ')
fprintf('%s%8.3f', ' L ',L(1))
fprintf('%s%8.3f', ' EA ',EI(1))
fprintf('%s%8.3f\n', ' qo ',qo(1))
fprintf('%s%8.3f', ' V(0) ',Fhat(1))
fprintf('%s%8.3f', ' M(0) ',Fhat(2))
fprintf('%s%8.3f', ' theta(0) ',Fhat(3))
fprintf('%s%8.3f\n', ' w(0) ',Fhat(4))
fprintf('%s%8.3f', ' V(L) ',Fhat(5))
fprintf('%s%8.3f', ' M(L) ',Fhat(6))
fprintf('%s%8.3f', ' Theta(L) ',Fhat(7))
fprintf('%s%8.3f', ' w(L) ',Fhat(8))
fprintf('\r%s\n', 'Span 2 ')
fprintf('%s%8.3f', ' L ',L(2))
fprintf('%s%8.3f', ' EA ',EI(2))
fprintf('%s%8.3f\n', ' qo ',qo(2))
fprintf('%s%8.3f', ' V(0) ',Fhat(5)-Fhat(21))
fprintf('%s%8.3f', ' M(0) ',Fhat(6))
fprintf('%s%8.3f', ' theta(0) ',Fhat(7))
fprintf('%s%8.3f\n', ' w(0) ',Fhat(8))
fprintf('%s%8.3f', ' V(L) ',Fhat(9))
fprintf('%s%8.3f', ' M(L) ',Fhat(10))
fprintf('%s%8.3f', ' Theta(L) ',Fhat(11))
fprintf('%s%8.3f', ' w(L) ',Fhat(12))
fprintf('\r%s\n', 'Span 3 ')
fprintf('%s%8.3f', ' L ',L(3))
fprintf('%s%8.3f', ' EA ',EI(3))
fprintf('%s%8.3f\n', ' qo ',qo(3))
fprintf('%s%8.3f', ' V(0) ',Fhat(9)-Fhat(22))
fprintf('%s%8.3f', ' M(0) ',Fhat(10))
fprintf('%s%8.3f', ' theta(0) ',Fhat(11))
fprintf('%s%8.3f\n', ' w(0) ',Fhat(12))
fprintf('%s%8.3f', ' V(L) ',Fhat(13))
fprintf('%s%8.3f', ' M(L) ',Fhat(14))
fprintf('%s%8.3f', ' Theta(L) ',Fhat(15))
fprintf('%s%8.3f', ' w(L) ',Fhat(16))
fprintf('\r%s\n', 'Span 4 ')
fprintf('%s%8.3f', ' L ',L(4))
fprintf('%s%8.3f', ' EA ',EI(4))
fprintf('%s%8.3f\n', ' qo ',qo(4))
fprintf('%s%8.3f', ' V(0) ',Fhat(13)-Fhat(23))
fprintf('%s%8.3f', ' M(0) ',Fhat(14))
fprintf('%s%8.3f', ' theta(0) ',Fhat(15))
fprintf('%s%8.3f\n', ' w(0) ',Fhat(16))
fprintf('%s%8.3f', ' V(L) ',Fhat(17))
fprintf('%s%8.3f', ' M(L) ',Fhat(18))
fprintf('%s%8.3f', ' Theta(L) ',Fhat(19))
fprintf('%s%8.3f', ' w(L) ',Fhat(20))
fprintf('\r%s\n', 'Numerical Analysis Parameter ')
fprintf('%s%8.3f\n', ' Number of simpson points ',npts)
fprintf('%s%8.3f\n', ' Number of GTR points ',GTR)
fprintf('%s%8.3f\n', ' Beta (GTR Parameter) ',Beta)
fprintf('\r%s\n', ' Reaction Force ')
fprintf('%s%8.3f\n', ' Reaction Force 1 ',n1)
fprintf('%s%8.3f\n', ' Reaction Force 2 ',n2)
fprintf('%s%8.3f\n', ' Reaction Force 3 ',n3)
Function Code
%CP5 Function Code
function [p] = LoadFunctionCP5(x,L,type)
%. Execute function indicated by the value of 'type'
switch type
case 1 % Constant load
p = 1;
case 2 % Linear ramp up
p = x/L;
case 3 % Linear ramp down
p = 1 - x/L;
case 4 %Trapezodial distrubtion
if 0<=x && x<= L*(1/3)
p=x*(3/L);
elseif x > (1/3)*L && x< L*(2/3)
p=1;
else x >= (L*2)/3
p=x*((-3)/L)+3;
end
case 5 %Sinusoidal distribution
p= sin(pi*x/L);
case 6 % Patch Load over interior
if 0<= x && x< L*(1/3)
p=0;
elseif L*(1/3) <= x && x< L*(2/3)
p=1;
else x>= (2*L)/3
p=0;
end
case 7
p=0;
end % switch
end %. End of function LoadFunctionCP5
PHYSICAL PROPERTIES
END CONDITION AND LOAD CASE NUMBER
Boundary condition at x=0 : simple
Boundary condition at x=L : simple
Span 1
L 10.000 EA 200.000 qo 2.000
V(0) 8.929 M(0) 0.000 theta(0) -0.327 w(0) 0.000
V(L) -11.071 M(L) -10.714 Theta(L) 0.238 w(L) 0.000
Span 2
L 10.000 EA 200.000 qo 2.000
V(0) 0.357 M(0) -10.714 theta(0) 0.238 w(0) 0.000
V(L) 0.357 M(L) -7.143 Theta(L) -0.208 w(L) 0.000
Span 3
L 10.000 EA 200.000 qo 2.000
V(0) 9.643 M(0) -7.143 theta(0) -0.208 w(0) 0.000
V(L) -10.357 M(L) -10.714 Theta(L) 0.179 w(L) 0.000
Span 4
L 10.000 EA 200.000 qo 2.000
V(0) 1.071 M(0) -10.714 theta(0) 0.179 w(0) 0.000
V(L) 1.071 M(L) 0.000 Theta(L) -0.089 w(L) 0.000
Numerical Analysis Parameter
Number of simpson points 21.000
Number of GTR points 40.000
Beta (GTR Parameter) 0.500
Reaction Force
Reaction Force 1 -11.429
Reaction Force 2 -9.286
Reaction Force 3 -11.429
Cannot find an exact (case-sensitive) match for 'Function'
The closest match is: function in C:\Program Files\MATLAB\R2017b\toolbox\matlab\lang\function.m
Error in CEE213_CP5 (line 292)
Function Code
Published with MATLAB® R2017b