代写 matlab graph CIV ENG 2E03 – Matlab Assignment #1

CIV ENG 2E03 – Matlab Assignment #1
Due: OCTOBER 25th, 2019 11:59pm
The purpose of this assignment is to consolidate your knowledge of the material on root finding methods and MATLAB functions from previous labs. As the new structural engineer working for a consulting firm, you’ve been asked to determine if the maximum deflection in the beam shown in Figure 1 exceeds the building code specified value of δallow = L/360. The beam is subjected to a linearly increasing distributed load, but your program should be flexible enough to allow for easy modification for other types of loading and support conditions.
Figure 1 – Roller-fixed beam under linearly increasing distributed load The equation for the deflection curve of the beam is given by:
𝑤0
𝑦(𝑥) = 120𝐸𝐼𝐿(−𝑥 +2𝐿 𝑥 −𝐿 𝑥)
5234
You are given the following parameter values: w0 = 175 kN/m (magnitude of the load)
E = I = L =
200 000 MPa (modulus of elasticity)
300.9×106 mm4 (second moment of area)
length of the beam = the last non-zero digit of your student number (in m).
i.e. if student # is 400080006, L = 6 m if student # is 400082000, L = 2 m
You have been asked to write a set of MATLAB programs to solve this problem.
Requirements (10 marks total)
1. (5 marks) Write a function to find the root of an equation. The root finding method you have to use depends on your lab session:
– Tuesday – False Position
– Thursday – Newton-Raphson
– Friday – Secant
Your function should take the following inputs:
1) Initial guess(es) – the number of initial guesses depends on what method you are using. Review your class notes if needed.
2) f – an anonymous function you are seeking the root of.
3) df – an anonymous function representing the derivative of the function you are seeking the
root of (whether you need this depends on what method you are using).
Your function should return the following outputs:
1) xr – the estimate of the root.
2) eps_a – a vector containing the approximation error from each iteration – this will allow you
to plot the error as a function of number of iterations.
3) numit – the number of iterations required to reach the solution.

CIV ENG 2E03 – Matlab Assignment #1
2. (3 marks) Write a script file that does the following (in this order):
1) Define variables L = length of the beam, w0 = magnitude of load, I = moment of inertia, E = modulus of elasticity with the values given in this assignment.
2) Define an anonymous function that computes the deflection, y(x), in the beam based on the given equation above. This function should take one input parameter, x, and should allow x to be a vector (i.e. use dot notation).
3) Define a second anonymous function that computes the rotation, θ = dy/dx, based on the first function y(x). This function should take one input parameter, x, and should allow x to be a vector (i.e. use dot notation).
4) Define a third anonymous function that computes the derivative of rotation = dθ/dx = d2y/dx2. This function should take one input parameter, x, and should allow x to be a vector (i.e. use dot notation). You may or may not need this depending on your root finding method.
5) Plot a curve for deflection and rotation on two separate sets of axes (either on the same figure or two figures). Make sure that the graph has a title, labels on the axes, and turn on the grid. This will allow you to determine your initial guesses.
6) Define your initial guess(es) for your root finding method.
7) Call your root finding function from Part 1 to find the location of maximum deflection within
the beam.
8) Plot the approximation error (eps_a) from your root finding against iteration number to show
how the function converges as the number of iterations increases. Make sure that the graph
has a title, labels on the axes, and turn on the grid.
9) Check whether the maximum deflection of the beam is less than the code specified limit of
L/360.
3. (2 marks) Create a summary output to the command window with the following information:
1) Your name, macid, and student number
2) Input parameters
3) Root finding method used
4) Root x value approximation (xr)
5) Deflection at the root xr = y(xr)
6) Final approximation error of the root (eps_a)
7) Number of iterations required to reach approximation (numit)
8) Whether or not the maximum deflection of the beam is less than the code specified limit
of L/360.
Your output should look similar to this (note that the numbers below are not the same as the answer you should find).

CIV ENG 2E03 – Matlab Assignment #1
Ensure that there is a block of comments at the top of all files with the following information:
1) A title of the script/function
2) A short description of the file, listing the inputs and outputs
3) Your full name
4) Your macid and student number
Submission Instructions
Submit BOTH your root finding function and the script file to the Avenue dropbox by the due date in a compressed ZIP folder. Name the folder “CE2E03_A1_MACID.zip”, replacing MACID with your Mac ID (i.e. CE2E03_A1_goforte.zip).
General Hints and Tips
1) Use the equation in your textbook to select an appropriate stopping criterion to an appropriate number of significant figures. For most civil engineering problems 5 significant figures are sufficient.
2) Be sure to include a stopping criterion based on the number of iterations so that the function does not run indefinitely. If the program reaches the maximum number of iterations, make sure to print this out in some way so that the user knows that the result is not correct.
3) The maximum deflection of a beam corresponds to the point where the rotation or slope (dy/dx) is zero.