HW7 (1)
pdf
keyboard_arrow_up
School
University of Florida *
*We aren’t endorsed by this school
Course
3344
Subject
English
Date
Apr 3, 2024
Type
Pages
3
Uploaded by MinisterMooseMaster790
EGM 3344
Summer 2023
Introduction to Numerical Methods of Engineering Analysis
University of Florida
Mechanical and Aerospace Engineering
Homework 7: I’m Looking for a Great
r
2
. Oh, Great
r
2
.
r
2
Not Make One Great
Due: Friday, July 28, 2023, 11:59pm.
Instructions:
1. Submit your solutions as a PDF document on Canvas.
2.
Include any and all plots in the PDF.
3. Also submit your individual .m files.
4. Do not submit a zipped file.
5. You may use MATLAB’s left division to solve systems of linear equations as long
as they are square.
6. Remember to use a superfluous amount of comments!
Problem 1:
Below are the floor-routine scores and the total scores for the University of Florida
Gymnastics team
1
for each meet in 2023. Write a MATLAB script called
hw7_p1.m
to
fit a line to the data, to fit a parabola to the data, and to fit an exponential function
to the data using linear least squares.
Plot the line, the parabola
2
, the exponential,
and the data in the same plot. (Remember that parabolas and exponential functions
are smooth and that data points are points
3
.)
Floor
Total
49.4
197.75
49.625
197.825
49.3
197.325
49.425
197.9
49.25
197.875
49.725
198.35
49.575
197.975
49.6
198.15
49.175
197.7
49.6
198.175
49.675
198.425
49.4
197.875
1
Go Gators!!
2
MATLAB will give you a warning for the parabola. You can ignore it.
3
This should be obvious, but you would be surprised, and by “you,” I mean one of y’all’s’ll roll into office hours
wondering why your parabola/exponential is a line. . . That is okay—that is the reason we have office hours.
Jonathan Brooks
1
EGM 3344
Summer 2023
Discuss your results:
Which fit best models the 2023 gymnastics team and why?
Is it a good model? As engineers, what should we advise Coach Rowland?
Jenkins
4
,
analysis!
Problem 2:
The file
hw7_p2.mat
contains US daily coronavirus cases for the months of March,
April, and May of 2020.
Write a MATLAB script called
hw7_p2.m
to compute the
cubic polynomial of best fit.
Use this “cubic model” to predict the number of daily
cases in August 2020. Plot the fitted curve through July 2020, along with the data.
Discuss your results:
Based on your (probably) limited knowledge of epidemiology,
what are the merits and/or critiques of this “cubic model?”
Problem 3:
On its mission, our rover has collected several soil samples and found various concen-
trations of the radioactive isotope, nickel-59.
The samples are from different eras in
the Martian past. The file,
hw7_p3.mat
, contains the measurements made by the rover
(time in years, where 0 denotes the present; and percent concentration of nickel-59).
Write a MATLAB script called
hw7_p3.m
to use
linear
least squares to find the line of
best fit, parabola of best fit
5
, and exponential function of best fit for the data. Plot
the data points and each of your best-fit curves in the same plot.
Discuss your results:
What are the arguments for or against each model?
Caveat:
Make sure you do an “apples-to-apples” for the exponential fit.
67
10 bonus points:
Use MATLAB’s
fminsearch
function to find the exponential func-
tion of best fit using
nonlinear
least squares (5 points), and explain why the answer is
different (5 points)
8
.
Problem 4:
This problem uses
hw7_p4.mat
, which contains the results of a food study. 100 partici-
pants tasted 10 cookies made with different recipes using varying amounts of 5 different
ingredients and rated their enjoyment levels; each participant tests the same set of 10
cookies. We want to find the equation of the best-fit hyperplane so that we may deter-
mine the ultimate cookie recipe! (Because there are 5 ingredients for each cookie and a
participant rating, that means there are 6 numbers associated with each data point—5
x
values and 1
y
value.)
Treat each rating from each participant as a separate data point, and write a MAT-
LAB script called
hw7_p4.m
to fit a hyperplane that relates the ingredients to overall
enjoyment.
Discuss your results:
What do these results mean for our cookie recipe?
Suggestion:
Instead of officially using multiple linear regression, use general linear
least squares
9
.
Hint:
Before you employ least squares, you will need to do a little preprocessing on
4
For the purposes of this sentence, your name is Jenkins.
5
MATLAB will give you a warning for the parabola. You can ignore it.
6
Cryptic!
7
This also applies to problem 1, too, but it is especially important for this problem.
8
Recall I mentioned this in class once before. . . It didn’t scare you enough then. It does now.
9
Or don’t. I’m not your mom.
Jonathan Brooks
2
EGM 3344
Summer 2023
the data. MATLAB’s
reshape
and
repmat
functions may come in handy for that part.
Extra Hint:
This is a thinking problem. Not a monkey-slapping-the-keyboard-hoping-
for-Shakespeare problem. You need to think hard first about how the data should be
organized. Thinking is the most challenging part of the problem
10
. Once you have a
plan for how to organize the data, the MATLAB code is
very
simple.
Problem 5:
It is time to play our favorite game show:
Guess the Fit!!
11
The file
hw7_p5.mat
contains some data.
Write a MATLAB script called
hw7_p5.m
to use general linear
least squares to obtain a curve of best fit.
Discuss your results:
Report your fitted curve, and describe your thought process
in obtaining it.
Note:
This problem is intentionally extremely vague. This is what it is like out in the
field—you collect data, you look at the data, and then you do not ask your boss, “Okay,
now what should I do?” Her reply will be, “Whaddya askin’ me for!
12
” Rather, you
use your big brain in all its wrinkly glory to do a good job and represent Gator Nation
well, collecting accolades and praise for not only you but
all
your fellow Gators—past
and present. A rising tide lifts all Gators
13
.
10
Thinking is done on paper and not solely in your head—sketch some empty dummy matrices to help visualize things!
11
Copyright Andrew Ouellette
12
https://youtu.be/kTcRRaXV-fg?t=144
13
Go Gators!!
Jonathan Brooks
3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help