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:

  1. (char) An NxM array representing the field after the pass

  2. (double) The distance the pass traveled in yards

  3. (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

  1. Figure out how far the receiver runs. Each '*' represents 1 yard.

  2. 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.

  3. 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!