ME 106
Homework 1
Deliver a Package by Air Simulation – a Graphical User Interface App
Deliver a Package by Air. A relief airplane is delivering a food package to a group of people stranded
on a very small island. The island is too small for the plane to land on, and the only way to deliver the
package is by dropping it.
Part 1 – Write a MATLAB Graphical User Interface (GUI) App to help the airplane pilot to determine
when to release the package in the air to ensure successful food delivery. Ignore air resistance in the
calculation. Assume the island is approximately at sea level.
Add an Axes to show a picture of the package in GUI when the program starts [5 pt]
.
Add another Axes to show a picture of the island in GUI when the program starts [5 pt]
.
The pilot can fly the airplane horizontally at a constant speed while inputting values into your
graphical user interface app. The pilot can set the horizontal speed of the airplane in miles per hour
(mph). Recall that 1 mph = 0.44704 m/s. The pilot can also set the altitude of the airplane in meters
(m) for calculation.
Add a Slider for the pilot to adjust the current constant airplane speed between 0 and 500 miles per
hour (mph) in GUI [5 pt]
.
Add an Airspeed Indicator in GUI. Show the speed Slider value in the Airspeed Indicator [5 pt]
.
Add another Slider for the pilot to adjust the current airplane altitude between 0 to 1000 meters (m)
in GUI [5 pt]
.
Add an Altimeter in GUI. Show the altitude Slider position value in the Altimeter [5 pt]
.
Add a Button in GUI. Provide the pilot a Button to press to start the simulation. This button will be
used to start the ideal path and ideal line-of-sight angle simulation. When the simulation Button is
pressed, the MATLAB program should compute the ideal distance D (the horizontal distance between
the airplane and the island) at which the package should be released [5 pt]
. Plot the ideal path of the
package projectile motion. The program will then advise the pilot, using a Label, the ideal angle in
degrees when the island appears in the pilot’s line-of-sight that the pilot should release the food
package.
Add a Label in GUI. Pressing the simulation Button should update the Label to show the ideal angle
in degrees when the island appears in the pilot’s line-of-sight that the pilot should release the food
package [5 pt]
.
Add another Axes in GUI. When the simulation Button is pressed, this Axes will be used to plot the
ideal package projectile motion in the x and y coordinates with 100 equally spaced points in GUI
from the moment the package is released in the air to the moment the object arrives to the island [5
pt]. The diameter of the island is approximately 40 meters. Assume the food will be at the center of
the island, add a line to represent the island in the plot [5 pt]. Add a point in the plot to mark the
ideal location of the airplane [2.5 pt]
.
The example equations to use: Ballistic Trajectory (2-D) Calculator – Computes the maximum height,
range, time to impact, and impact velocity of a ballistic projectile (convertalot.com)
Add another Label in GUI. Pressing the simulation Button should also start the line-of-sight angle
counter, starting from 0 degree, incrementing 0.1 degree at a time, in the Label [5 pt]. The MATLAB
built-in pause function can pause the counter briefly (i.e. 0.1 second) between the increments [5 pt]
.
Part 2 – Add another Button in GUI. Provide a release food Button for the pilot to release the food.
The pilot can look at the line-of-sight angle counter to press the release food Button at the right
angle. When the release food Button is pressed, the line-of-sight angle counter Label should stop
incrementing [5 pt]
.
It is possible that the pilot can miss the ideal line-of-sight angle. With the same constant speed and
altitude as the pilot input in the edit text boxes or sliders, calculate if the food would land on the
island using the line-of-sight angle when the pilot presses the button to release the food [5 pt]
.
Compute the actual horizontal distance between the airplane and the island (actual x) using the
actual angle and h. Compute the delta between D and actual x [5 pt]. Add delta to the ideal xdirection coordinates to obtain the actual x-direction coordinates of the food.
Add the actual food projectile motion to the same figure Axes generated from Part 1 [5 pt]. Add
another point in the plot to mark the actual location of the airplane [2.5 pt]
.
Add plot title, legends, and label each axis clearly [5 pt]
.
Add an if..else..end statement in the program to compare if the absolute value of delta is less than or
equal to 20 m. If it is, update the picture Axes of the island to a new successful picture [5 pt]
.
Otherwise, update the picture Axes of the island to another picture to let the pilot know that the
food is in the sea [5 pt]
.
Additional components are always welcome!
(Here is an example components and display when the program starts.)
(Here is an example components and display after providing the h and V0.)
(Here is an example components and display after pressing the simulation button.)
(Here is an example components and display after pressing the release button early.)
(Here is an example components and display after pressing the release button at the right time.)
Ensure your hw1 folder contains your .mlapp and all the picture files.
Include all the files used in HW1 APP in the same folder.
Zip the entire hw1 folder.
Rename the hw1.zip to LastName_FirstName_ME106_hw1.zip
Submit the .zip file to Moodle.