Task 1. Numerical integration of measurement data (40 points)

A surveying team is taking measurement along the cross-section of a canal that is 18 meter wide.

The following measurements are taken

Table 1. Measurements

x(m) Depth (m)

0 0

3 1.4

6 2.5

9 3.1

12 3.2

15 1.7

180

1.Create a CSV file to contain the data

2.Produce MATLAB script and functions to do the following

a.Read the CSV file

b.Plot the depth of the canal along the cross-section

c.Numerically estimates the average depth of the canal using different methods and implementations

i.Your own implementation of the trapezium method, using a loop to iterate over the measurement data

ii.Your own implementation of the Simpson’s Rule, using a loop to iterate over the measurement data

iii.Your own implementation of the Simpson’s Rule, avoiding the use of a loop by using operations on vectors

iv.MATLAB’s built-in trapz() function

3.Report your results and discuss the findings

4.In your discussion, address the following questions: In this scenario the measurements are taken at equal intervals of 3 meter, but the surveying team can only work at a limited precision and accuracy. How would the results be affected by these limitations?

Task 2: Numerical integration of a function (30 points)

Consider the following function:

( ) = −0.5 × (sin( ) + 0.2 ) (1)

1.Write a MATLAB script to plot the function

2.Use the Gauss–Legendre quadrature to integrate the function over the domain [2,4]; use different numbers of points.

3.Compare your results to using MATLAB in-built integral() function

4.Report your results and discuss the findings

Task 3: Bending moment for a distributed load (30 points)

Consider the following simple supported beam subject to a distributed load:

Figure 1. Distributed load on a beam

Write a function function that produces a calculates the bending moment for any point along the beam, where the function f, and the lengths a,b and c are input parameters.

1.Present the mathematical approach to calculating the bending moment at any point of the beam.

2.Present your function function for the bending moment

3.Apply the function function with a variety of inputs to verify that it is working correctly.

4.Apply the function in a MATLAB script using a = 2 m, b = 4 m and c = 10 m. The distributed load f(x) is given by Equation (1) and the unit is kN/m.

5.Present and discuss your results. In your discussion, address the appropriate role of computing in solving engineering problems.