Question
for matlab Function Name: goLong Inputs: 1. (char) An NxM array representing the field before the pass Outputs: (char) An NxM array representing the field
for matlab
Function Name: goLong Inputs:
1. (char) An NxM array representing the field before the pass
Outputs:
-
(char) An NxM array representing the field after the pass
-
(double) The distance the pass traveled in yards
-
(double) The distance the receiver ran in yards
Background:
With Atlanta getting in the Super Bowl spirit, you decide to volunteer for the Georgia Tech football team to help them with some advanced analytics. With the team dropping the triple option, the coaches want your help looking at some passing plays.
Function Description:
You will be given a character array that represents the field before the play is run. The character 'Q' will represent the quarterback, the character 'W' will represent the wide receiver, and the '*' characters will be the the path the wide receiver follows. Given this diagram, you will need to
-
Figure out how far the receiver runs. Each '*' represents 1 yard.
-
Update the diagram to show what it will look like once the play has been run with the
wide receiver at the end of their route. The end of the wide receivers route will always
be the '*' character closest to the top of the array.
-
Determine how far the ball travels in the air, from the quarterback ('Q') to the wide
receiver ('W'). Each index counts as one yard. The ball travels straight from the quarterback to the receiver, not necessarily along the rows and columns.
Example:
play=[' * ' ' ****' '*' '*'
'Q W']
>> [finalPlay, throwDist, runDist] = goLong(play)
finalPlay = [' W ' throwDist = 4.47 runDist = 7 ' ****'
'*' '*' 'Q ']
Homework 5 - Arrays
Notes:
-
Round the throw distance to 2 decimal places.
-
There will only be one '*' on the row closest to the top (i.e. there will never be more
than one ending location).
-
The background will always be spaces (' ').
Hints:
-
The find() and sum() functions will be useful.
-
Remember the distance formula?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started