Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Topics: User Defined Functions and MATLAB Conditionals An Engineer has requested

ID: 3601243 • Letter: T

Question

Topics: User Defined Functions and MATLAB Conditionals


An Engineer has requested you write a program to calculate the deflection at center, deflection at load and the maximum deflection of a level beam with a load at a specified number of equidistant points along the beam that is supported by a point at each end.

The following formulas are applied where a>=b, for those points where a
b with a. Where P is the load in pounds, L is length of the beam in inches, E is the modulus of elasticity (psi), I is the moment of inertia (in4). The ‘a’ symbol in inches along the beam from the left side for the equidistant point for which you are calculating the deflections. The ‘b’ symbol is b = L-a.

MaxDeflection= -PbL2- b2 3/293 EIL

Deflection_at_Load = -Pa2b23EIL

Deflection at Center= -Pb(3L2-4b2)48EI

P

L

b

a

Ask the user for the following inputs (must be non-negative).:

Length of the beam in inches.

Load in pounds.

Modulus of elasticity in psi.

The number of points to have deflection computed for, including the two ends (must be >=2 and an integer). This vector is ‘a’.

You program must then call the function ‘deflection’ to compute the deflection at center, deflection at load and the maximum deflection deflections for each of equidistant points (A vector).

You must the generate a report with 4 labeled columns, Position, Maximum Deflection, Deflection at load, and Deflection at center as shown in the sample run

Finish the following MATLAB function and write a MATLAB Script that (uses that function) to satisfy the above description.

function [ max_Def, def_at_Load, def_at_Center ] = deflection( A, P, I, L, E )

%{

This function gets the following arguments IN

A is a vector of the equidistance points for the deflection to be calculated along the beam.

P is a scalar representing the load in pounds

I is a scalar representing the moment of inertia

L is a scalar representing the length in inches

E is a scalar representing the modulus of elasticity

The function returns the following arguments OUT

max_Def is a vector of the maximum deflections of the beam

def_at_Load is a vector of deflection of the beam at the point of the load

def_at_Center is a vector of deflection of the beam at its center

%}

Outline:

Create a MATLAB Function .m file – named deflection.m

Copy the skeleton function given

Finish the function by assigning all of the output variables correctly

Create a MATLAB Script .m file – named Program05.m

Write the necessary MATLAB commands to prompt for and read into variables all the variables needed

Call your deflection.m function to compute the deflections

Format and display to the screen, the output report for the position, max_deflection, deflection_at Load and deflection_at_Center as shown in the sample run

Notes(s):

Sample Run(s):

>> Program05

Beam Defection Program

User Input

------------------------------

Enter the length of the beam in inches: 360

Enter the weight of the load in pounds: 24000

Enter the modulus of elasticity in psi: 30e06

Enter the moment of inertia: 795.5

Enter the number of points (including the ends you want along the beam): 11

Position Maximum Deflection Deflection

(inches) deflection at load at center

------------------------------------------------------------------------------------

0.0 -0.0000 -0.0000 -0.0000

36.0 -0.2965 -0.1267 -0.2893

72.0 -0.5662 -0.4004 -0.5552

108.0 -0.7839 -0.6897 -0.7742

144.0 -0.9269 -0.9009 -0.9228

180.0 -0.9775 -0.9775 -0.9775

216.0 -0.9269 -0.9009 -0.9228

252.0 -0.7839 -0.6897 -0.7742

288.0 -0.5662 -0.4004 -0.5552

324.0 -0.2965 -0.1267 -0.2893

360.0 -0.0000 -0.0000 -0.0000

>>

Explanation / Answer

Mutually equidistant points here means, Every point on that line should be at equal distance with its neighbouring point on that line only (1,1 -> 3,3 -> 5,5 -> 7,7).

A line would be discarded if it
contains non-mutually equidistant
points(or point). (1-1 -> 3,3 ->5,5 ->6,6 is an invalid line).