0% found this document useful (0 votes)
153 views3 pages

ME 2016 Spring 24 Homework 1

This homework assignment involves numerically solving a first-order ordinary differential equation (ODE) modeling the velocity of a free-falling parachutist using Euler's method. Students are asked to write MATLAB code to compute and plot analytical and numerical solutions for different step sizes over 30 seconds. They must also discuss how the numerical solutions differ for different step sizes and aspects of their code that make it modular. Deliverables include a professionally formatted report with plots, code output, and discussions, as well as professionally formatted MATLAB script and function files.

Uploaded by

Pedro T
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
153 views3 pages

ME 2016 Spring 24 Homework 1

This homework assignment involves numerically solving a first-order ordinary differential equation (ODE) modeling the velocity of a free-falling parachutist using Euler's method. Students are asked to write MATLAB code to compute and plot analytical and numerical solutions for different step sizes over 30 seconds. They must also discuss how the numerical solutions differ for different step sizes and aspects of their code that make it modular. Deliverables include a professionally formatted report with plots, code output, and discussions, as well as professionally formatted MATLAB script and function files.

Uploaded by

Pedro T
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

ME 2016 - Computing Techniques (Spring 2024)

Homework 1
Due: January 24, 2024

Professionalism (20 pts) Points


Report includes problem description and discussion in complete sentences 2
Report includes header/footer (name, date, course #, assignment #, page #) 2
Code includes header (name, date, description, input/output variable definitions) 2
Code runs without error 4
Command window output is easily legible 4
Extraneous command window output is suppressed 2
Plots are well-formatted (axis labels, units, line/marker styles, legend) 4
TOTAL 20

Parachutist problem (80 pts) Points


Correct analytical solution 8
Correct numerical solutions (4 of them) 32
Uses function handle to store, pass, and evaluate ODE 5
Function handle to ODE accepts both t and v as input 5
Loops are used rather than repeated lines of code 10
Calls Euler function to perform single step of numerical method 5
Euler function updates both t and v 5
Discussion is complete and makes sense 10
TOTAL 80

Total Points: _______ /100


ME 2016 - Computing Techniques (Spring 2024)

Homework 1
Due: January 24, 2024

Learning Objectives
• To familiarize ourselves with the idea that numerical methods provide approximate solutions to mathematical
problems and to see an example of how we might control the error in our approximation.
• To recall important Matlab programming concepts (i.e., script files, function files, function handles, for
loops, while loops, conditional statements, plotting, and professional formatting).

Problem description
Before releasing the parachute, the acceleration of a free-falling parachutist can be modeled by the following first-
order, linear ordinary differential equation (ODE),

𝑑𝑑𝑑𝑑(𝑡𝑡) 𝑐𝑐
𝑑𝑑𝑑𝑑
= 𝑔𝑔 − 𝑚𝑚 𝑣𝑣(𝑡𝑡), (1)

with initial condition, 𝑣𝑣 (t0 = 0) = 0. In (1), the independent variable, t, is time; the dependent variable, 𝑣𝑣(𝑡𝑡), is
the parachutist’s velocity; the parameter, m = 81.6 kg, is the parachutist’s mass; the parameter, c = 14.5 kg/s, is the
drag coefficient; and the parameter, g = 9.81 m/s2, is the gravitational constant.

Your tasks
Write a Matlab script to compute and plot the velocity of the parachutist (before releasing the parachute) over a
time interval of 30 seconds. Compare analytical and numerical (Euler’s method) solutions by plotting the following
curves on one plot:

• Plot the analytical solution computed every 1 second using a solid black line with no markers. Denote this
curve as “Analytical” in the figure legend.
• Plot the numerical solution with ∆t = 5 seconds using a dashed red line (RGB = [228, 26, 28]) with circular
markers. Denote this curve as “Numerical (dt = 5 s)” in the figure legend.
• Plot the numerical solution with ∆t = 3 seconds using a dashed blue line (RGB = [55, 126, 184]) with circular
markers. Denote this curve as “Numerical (dt = 3 s)” in the figure legend.

• Plot the numerical solution with ∆t = 2 seconds using a dashed green line (RGB = [77, 175, 74]) with circular
markers. Denote this curve as “Numerical (dt = 2 s)” in the figure legend.
• Plot the numerical solution with ∆t = 1 second using a dashed purple line (RGB = [152, 78, 163]) with
circular markers. Denote this curve as “Numerical (dt = 1 s)” in the figure legend.

Your code should be written in a script file, Script_ParachutistVelocity.m, that defines the ODE in (1) as an
anonymous function handle, and calls a function file, Euler.m (please see Fig. 2 for a possible function header), to
perform a single step of the numerical method (i.e., it should perform the update from (ti, v (ti)) to (ti+1, v (ti+1)) -
include one line of code to update t and one line of code to update v). For each numerical solution, please output
to the command window (in an easily legible way - hint: use fprintf) the time and velocity computed for each
timestep. An example of the plot and a portion of the command window output are provided in Fig. 1.

Your discussion
In your report, discuss 1) how and why the numerical curves differ for different values of ∆t and 2) what aspects of
your code make it modular and why.

1
ME 2016 Homework 1 Due: January 24, 2024

Deliverables
Please place all files described below (e.g., .docx, .pdf, .m) in a zipped folder and upload to Canvas using the
following naming convention: “HW#_FamilyName_FirstName.zip.”
(a) Professionally-formatted report. Please provide a brief description of the problem, an image of the plot
output by your code, a screenshot of the command window output from your code for the
∆t = 5 case, and the discussions indicated above. Be sure to format your report professionally. Your plot
should include meaningful axis labels with units, a legible legend, and curve formatting as specified above.
Matlab’s “grid on” and “box on” commands are also suggested. Your report should include a header/footer
with your name, date, course number, assignment number, and page number. (See templates posted on
Canvas)

(b) Professionally-formatted source code. Include Script_ParachutistVelocity.m, Euler.m, and any other
functions (if any) that you wrote to complete the assignment. Please be sure that your code runs
directly upon download of your zip file. Be sure to format your code professionally. At the top of each
script/function, include your name, the date, and a description of the file - for functions also define all
input and output variables. Use comments and indenting for code readability.

Figure 1: Freefalling velocity of a parachutist over an interval of 30 s after starting from rest: (a) Comparison of
analytical solution to four numerical solutions with different stepsize, ∆t; (b) Command window output of time and
velocity for each time step for the ∆t = 5 s case. (this is sample data - your results will most likely be
different)

Figure 2: Possible header of the Euler.m function.

You might also like