Matlab Functions
Matlab Functions
+ = = F f f F
R L y
0
)
`
=
)
`
=
= +
xF
F
f
f
L
F x f L
F f f
R
L
R
R L
0
1 1
L
f x M =
4/17/2012 Matlab Functions 13
mainline routine - beam.m
Create a new folder beam for the files in
this project
Create the mainline routine in beam.m
as shown
Plan the program by dividing it into logical
steps and laying out each step in a
separate function.
BeamParams get user input for the
beam length, applied force, and number
of beam divisions.
Calculations solve the equilibrium
equations for the support forces and
maximum bending moment for each load
application point
PlotMoment plot the beam bending
moment variation with load application
point
Each function will be developed and
tested individually
The perfect performance of each function
must be verified before work on the next
function begins
4/17/2012 Matlab Functions 14
BeamParams
Enter the function BeamParams as shown
Modify the mainline routine in beam.m to
verify that the user input is successfully
achieved
Execute beam.m from the command
window to verify the operation of
BeamParams
4/17/2012 Matlab Functions 15
BeamParams
Enter the function BeamParams as shown
Modify the mainline routine in beam.m to
verify that the user input is successfully
achieved
Execute beam.m from the command
window to verify the operation of
BeamParams
4/17/2012 Matlab Functions 16
BeamParams
Enter the function BeamParams as shown
Modify the mainline routine in beam.m to
verify that the user input is successfully
achieved
Execute beam.m from the command
window to verify the operation of
BeamParams
4/17/2012 Matlab Functions 17
Calculations
Enter the function Calculations as shown
Note that the calculations are repeated for
n+1 loading point locations
The equilibrium equations are entered in
matrix format with A holding the
coefficient matrix, s as the vector of
unknowns, R as the right-hand side vector
The equations are solved with the Matlab
backslash operator \ which is equivalent
to multiplying R by the inverse of A to
determine s.
Modify the mainline routine to test
Calculations.m
Execute the mainline routine and verify
the results shown.
4/17/2012 Matlab Functions 18
Calculations
Enter the function Calculations as shown
Note that the calculations are repeated for
n+1 loading point locations
The equilibrium equations are entered in
matrix format with A holding the
coefficient matrix, s as the vector of
unknowns, R as the right-hand side vector
The equations are solved with the Matlab
backslash operator \ which is equivalent
to multiplying R by the inverse of A to
determine s.
Modify the mainline routine to test
Calculations.m
Execute the mainline routine and verify
the results shown.
4/17/2012 Matlab Functions 19
Calculations
Enter the function Calculations as shown
Note that the calculations are repeated for
n+1 loading point locations
The equilibrium equations are entered in
matrix format with A holding the
coefficient matrix, s as the vector of
unknowns, R as the right-hand side vector
The equations are solved with the Matlab
backslash operator \ which is equivalent
to multiplying R by the inverse of A to
determine s.
Modify the mainline routine to test
Calculations.m
Execute the mainline routine and verify
the results shown.
4/17/2012 Matlab Functions 20
Plot Moment
Enter the function PlotMoment as shown.
Modify the mainline routine to test
PlotMoment
Execute the mainline routine from the
command window
Verify the results shown
4/17/2012 Matlab Functions 21
Plot Moment
Enter the function PlotMoment as shown.
Modify the mainline routine to test
PlotMoment
Execute the mainline routine from the
command window
Verify the results shown
4/17/2012 Matlab Functions 22
Plot Moment
Enter the function PlotMoment as shown.
Modify the mainline routine to test
PlotMoment
Execute the mainline routine from the
command window
Verify the results shown
4/17/2012 Matlab Functions 23
Plot Moment
Enter the function PlotMoment as shown.
Modify the mainline routine to test
PlotMoment
Execute the mainline routine from the
command window
Verify the results shown
4/17/2012 Matlab Functions 24
TabResults
Create a new function TabResults that
can be called from beam.m as shown
Verify the results shown
4/17/2012 Matlab Functions 25
TabResults
Create a new function TabResults that
can be called from beam.m as shown
Verify the results shown