Minimizing Target Error of a Projectile
Summary
An assignment to undergraduate students in a design optimization course. This activity helps students understand finding the minimum value of a one-variable function using MATLAB. Finding the minimum value of a one-variable function is a foundation of more general multi-variable multi-dimensional optimization problems.
Learning Goals
Upon completion of this activity, students will be able to find a minimum value of a one-variable function using MATLAB. Students will learn to program with functions in a script file. Students will also be able to create a graph to visualize the results.
After the activity, students will be able to:
- Create a MATLAB script.
- Create and use user-defined functions with input-output parameters.
- Understand and use MATLAB ode45() function.
- Understand and use MATLAB fminbnd() function.
- Create and display a simple 2D plot of a single-variable function using MATLAB.
- Process ill inputs and handle them properly with informative message outputs.
After the activity, students will be able to:
- Create a MATLAB script.
- Create and use user-defined functions with input-output parameters.
- Understand and use MATLAB ode45() function.
- Understand and use MATLAB fminbnd() function.
- Create and display a simple 2D plot of a single-variable function using MATLAB.
- Process ill inputs and handle them properly with informative message outputs.
Context for Use
I have not used MATLAB in my previous courses yet. So, this activity is designed for future use only and have not presented to the students yet. This activity will be used in a design optimization course. Engineering design problems are converted to multi-variate (design variables) and multi-dimensional mathematical equations (design goals) subject to various design constraints. A design solution is a set of values of the design variables that satisfies the constraints (equality and inequality equations), and the value of the objective function indicates how good or bad the design is. Finding the best design is obtained by solving the optimal objective function value of the design variables while satisfying the constraint equations. Usually, the objective function is constructed such that the minimum value is the optimal value.
One of the basic mathematical tools for computing the optimal value is finding the minimum value of a single-variable one-dimensional function. The tool can be used in finding the minimum values of more general multi-variable multi-dimensional objective functions by repeatedly applying the tool.
This activity is assigned in the first part of the course (around week 2 or 3 ). Students will also learn the basic skill in creating simple two-dimensional graphics using MATLAB.
One of the basic mathematical tools for computing the optimal value is finding the minimum value of a single-variable one-dimensional function. The tool can be used in finding the minimum values of more general multi-variable multi-dimensional objective functions by repeatedly applying the tool.
This activity is assigned in the first part of the course (around week 2 or 3 ). Students will also learn the basic skill in creating simple two-dimensional graphics using MATLAB.
Description and Teaching Materials
If an object is shot with an initial velocity at an angle, then the projectile of the object can be calculated. If the initial velocity is fast enough, the object is to find the initial velocity and angle of the object so that it hits the target on the wall that is standing at a certain distance from the launch. If there is no air resistance, this problem can be easily solved with a few simple mathematical equations in a closed analytic form. The dragging force by the air, however, it is not trivial to solve the problem by hand.
By keeping the same initial velocity, the trajectory of the object can be changed by adjusting the initial inclination angle of the projectile, hence hitting the target. The goal of this activity is to find the best angle of the initial inclination for the object to hit a specific target on the wall given the initial velocity.
A Handout for Projectile Assignment (Acrobat (PDF) 129kB Aug19 19)
By keeping the same initial velocity, the trajectory of the object can be changed by adjusting the initial inclination angle of the projectile, hence hitting the target. The goal of this activity is to find the best angle of the initial inclination for the object to hit a specific target on the wall given the initial velocity.
A Handout for Projectile Assignment (Acrobat (PDF) 129kB Aug19 19)
Teaching Notes and Tips
Before assigning this activity, the derivations of the equations of projectile motions need to be explained. The MATLAB function fminbnd and ode45 must be discussed with some examples. The highlight of this activity is understanding the usage of fminbnd function.
Share your modifications and improvements to this activity through the Community Contribution Tool »
Assessment
The assessment of the assignment is quite simple.
(a) For various initial velocities, check if the final target (x, y) points are obtained.
(b) Try smaller initial velocity so that the projectile does not reach the wall. Check if a proper error message is generated and gracefully error out. Also, check random invalid angles such as negative values and check if they are properly handled.
(a) For various initial velocities, check if the final target (x, y) points are obtained.
(b) Try smaller initial velocity so that the projectile does not reach the wall. Check if a proper error message is generated and gracefully error out. Also, check random invalid angles such as negative values and check if they are properly handled.
References and Resources
Howard B. Wilson, Louis H. Turcotte , David Halpern, "Advanced Mathematics and Mechanics Applications Using MATLAB", 3rd Edition, Chapman & Hall/CRC , 2003