Assignment 2
Assignment 2
11, 2019
Assignment #2 Due: Oct. 17, 2019 at 5:00 pm
5
Instructions: If you discuss the homework problems with other students, please refrain from
(? !8;!!2? ? 468,0!?
looking;,8)? ? )6(!?
at their code or 2? ? 6392?
+5 write-ups (or sharing your own). Ultimately, you must implement your
? )6(!? #,7?(,:!2?
own code=? 8)!?
and!598,32?
write up your own solution to be turned in. Your solution to the problems,
5
including
Gradescope
plots and requested output from your code for the assignment should be submitted via
as a pdf file. Upload any code you have written for the assignments on Gradescope
as well. You can access Gradescope on Canvas, where you can upload your solutions.
1 ? ,7? 8)!? 4!61,88,:,8=? 327828? 2?
,7?
Problem: Consider a simply supported beam as shown below. The beam is loaded with a
68,0!? !8!61,2!? 8)!? ,782!?
,"?
5 ?
rectangular distributed load. The deflection, y, of the centerline of the beam as a function of the
,5 5
? 2? x,
position, 5is1? by the following equation:
given
? "928,32?
!02!)&))25 8)8? ;7? !:!034!?
)?? 7868,2(? ,28!6:0? 3"?
𝑤! 𝑥
(7𝐿! − 10 𝐿! 𝑥 ! + 3𝑥 ! )
? '28,32? 2&0&))25 &31?630!1? #
𝑦=
360 𝐿𝐸𝐼
where L= 4 m is the length of the beam, E = 70 GPa is the elastic modulus, I=52.9×10-6 m4 is the
08,2? '28,32? 4.)5
moment of inertia, and w0= 20 kN/m.
!? !1? ,7? 03!? ;,8)? ? ,786,98!?
!8,32?
3"? 8)!? !28!6? 0,2!? 3"? 8)!? !1?
,32?
,7? (,:!2? =? 8)!? !598,32?
#
# !
#
#
5 5
1
7? 3"?* 2? 730:!? %6?*?
SE 121A: Introduction to Computing for Engineers Oct. 11, 2019
Assignment #2 Due: Oct. 17, 2019 at 5:00 pm
xx is your initials. x_est is the initial estimate in Newton’s method. tol is the maximum
acceptable value for the estimated relative error. max_iter is the maximum number of
times you allow for the iterations to take place. If the solution is not obtained with the
desired accuracy after max_iter number of iterations, the program should terminate and
print a message that notifies the user.
Use x=1 as your initial guess and run your code with tol = 10-14. Create a plot using
MATLAB that shows the estimated relative error versus iteration number with
logarithmic scale for y axis. This plot is called the convergence plot.
[Hint: to do this, you can store the relative error calculated at each iteration in a vector,
and use MATLAB’s Plot function or semilogy function]
1. Your pseudo-code.
2. Your MATLAB code.
3. Position, x, at which the deflection of the beam is maximum (with tol = 10-14) and the
deflection at that point.
4. Convergence plot
C) Use MATLAB’s built-in fzero function and obtain position, x, at which the deflection of
the beam is maximum and the deflection at that point.
Submit all lines of code you have written for this part along with the output.
2