Matlab homework

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

B