# Engineering

EML 3035 β Homework 2 Due: 4/24 by midnight Problem 1 (5 points) A simply supported beam is loaded as shown in the figure below. The vertical deflection of the beam, V, varies along the length of the beam and is given by

π = #

ππ 6πΈπΌπΏ

[(βπΏ- + π-)π₯ + π₯1], 0 < π₯ < π

ππ 6πΈπΌπΏ 7

(βπΏ- + π-)π₯ + π₯1 β πΏ π (π₯ β π)

18 , π < π₯ < π

where, E is the beamβs Youngβs Modulus and I is the moment of inertia.

Write a function that outputs the vertical deflection of the beam at a point x of interest. Call the function deflection_yourlastname. The function inputs would be: 1) distance from the left end to the point of interest, x 2) length of the beam L 3) load, P 4) location where the load P is applied, a 5) Youngβs modulus of the beam, E 6) Moment of inertia, I The output of the function will be the beam deflection, V. Display this output with an fprintf. Run the file for the following input sets: a) x=2.5, L=5, a=3, E=30e6, I = 0.0256, P=30 b) x=4.05, L=5, a=3, E=30e6, I = 0.0256, P=30

P

x L

a b

Problem 2 (5 points) Write a function that checks whether a matrix is tridiagonal or not. A tridiagonal matrix is such that has nonzero elements on its main diagonal, the first diagonal below this and the first diagonal above the main. Outside of this, all other elements are zeros. For example:

π΄ = ; 2 β1 4 3

0 0 β3 0

0 5 0 0

β1 8 4 3

B

A is a tridiagonal matrix. The input parameter for your function will be a matrix. Use loops and if statements to check if the matrix is tridiagonal or not. When I run your program it should display a sentence stating whether the matrix is tridiagonal or not. Call the function tri_check_yourlastname. Test your program with these two matrices: a)

; 2 β1 4 3

0 0 β3 0

0 5 0 0

β1 8 4 3

B

b)

; 2 β1 4 3

1 0 β3 0

0 5 6 0

β1 8 4 3