$30
ENSC 180: Introduction to Engineering Analysis
Assignment 2
Note: MATLAB codes should include definition of all variables; headings to identify
the program structure plan; and appropriate captions and labels for tables and
figures. Marks will be deducted for poorly documented answers.
1. Consider the equations cos(x) = x and tan(x) = x. Plot these functions and write a
MATLAB code to find their roots in the range -2π <x < 2π to a precision of 0.01
radians. (15 marks)
2. Students in a class have the following final marks.
x= [73 92 65 41 37 80 67 54 90 82 85 69 76 74 82 87 69 78 85]
The grading scheme is: = 90 A+; 80-89 A; 75-79 B+; 68-74 B; 60-67 C+; 50-59
C; 40-49 D; <40 F. Write a MATLAB code to assign grades for this class. Print the
marks and corresponding grades in two columns. (20 marks)
3. Wind tunnels are extensively used in airplane and spacecraft design to assess drag,
which is the force generated by an object when moving through a fluid such as air.
Inside a wind tunnel an object (e.g., model of a plane) is held stationary and air
flows through the tunnel at different speeds. The object is instrumented to collect
data. Drag is calculated using the following equation.
𝐹𝑑 = 𝐶𝑑(𝜌𝑉
2A/2)
where Cd, ρ, V and A denote the drag coefficient, air density, velocity of the aircraft
and the surface area over which the air flows.
Write a MATLAB code that requests the measured drag force, air velocity, surface
area and air density as input, calculate the drag coefficient and plot drag force over
the velocity range 0 to 300 km/h. (15 marks)
4. The height of a rocket is approximated by the following equation.
H = 2.13t
2 – 0.0013t
4 + 0.000034t
4.751
where H is the height (meters) and t is the time (seconds).
Calculate the maximum height reach by the rocket using MATLAB, time to reach the
maximum height (one second accuracy) and the time the rocket hit ground (one
second accuracy). Compare your answers using analytical methods. Plot H and t from
t=0 to until the rocket hit ground. (20 marks)
5. The parking hours to be used by three people at Vancouver Airport over 10 days
are given below.
4.0 1.5 6.0
48.0 0.0 5.5
1.0 1.5 5.0
0.75 12.0
1.00 3.00
8.0 1.5
72.0 0.0
2.00 1.5
2.0 1.5
0.0 4.0 2.75
2.5 4.0 1.5
1.75 12.0 2.0
The rate structure for parking is:
Short-term parking: First 30 minutes $2.50 and each additional 15 minutes or
fraction thereof is $ 1.00. Daily maximum is $ 25.00.
Long-term parking: First 3 hours $ 10.00 and each additional hour or fraction
thereof is $3.00. Daily maximum is $ 18.00. Weekly maximum is $ 80.00.
Write a MATLAB code to decide which parking lot (short-term or long-term)
should be used each time to minimize the cost and calculate the total minimum
parking bill over the 10 days for each person. (30 marks)