Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Function Name: sportsStats Inputs: 1. (double) An Nx5 array representing the stats of different football teams 2. (double) The cutoff for total penalties Outputs: 1.
Function Name: sportsStats Inputs: 1. (double) An Nx5 array representing the stats of different football teams 2. (double) The cutoff for total penalties Outputs: 1. (double) An Mx5 array representing the updated stats Background: You just finished watching the Patriots defeat the Rams in Super Bowl LIII, and you just can't wait for the next season to start. However, instead of waiting around for the next football season, you decide to take matters into your own hands and create a MATLAB function that will determine which teams will be among the top competitors for the Super Bowl LIV ring Function Description You will be given an Nx5 array of stats, with each row representing an NFL team. Each of the columns will represent, from left to right, the following: 1) Average points per game, 2) Average rushing yards per game, 3) Average passing yards per game, 4) Total number of first downs, and 5) Total number of penalties. In order to thoroughly analyze these teams, you must make the following changes to the stats array: 1. Append a new column to the right of the array that contains the average total yards per game, calculated by adding together the average rushing yards and average passing yards 2. Remove all teams with a total number of penalties higher than the given cutoff. 3. Remove the column representing the total number of first downs. 4. Sort the rows in descending order by the average number of points per game. 5. Remove the bottom half of the teams from the array, so you are left with the teams with the best points per game. Example: PPG ARY APY FD P [26.8 90.3 313.0 378 111 >>stats 25.1 126.3 236.3 333 105 20.3 103.8 223.5 325 94 26.3 121.1 222.8 331 97 105 >>cutoff >> newStats sportsStats (stats, cutoff) PPG ARY APY P ATY 26.3 121.1 222.8 97 343.9 >>newStats => 25.1 126.3 236.3 105 362.6 1
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