Question: MATLA Function Name: sportsStats Inputs: 1. (double) An Nx5 array representing the stats of different football teams 2. (double) The cutoff for total penalties Outputs
MATLA 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 LiI, 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 >> stats [ 26.8 98.3 313.0 378 111 25.1 126.3 236.3 333 185 20.3 103.8 223.5 325 94 26.3 121.1 222.8 331 97 > cutoff 105 > newStats sportsStats (stats, cutoff) PPG ARY APY P ATY >newStats [ 26.3 121.1 222.8 97 343.9 25.1 126.3 236.3 105 362.6] Homework 5-Arrays Notes If there are an odd number of teams remaining before step 5, the middle team should remain in the array There will not be any ties for average points per game between teams Function Name: sporesseets Inputs: (0ouDi) Am Na5 aray regresenting the stats of dfferent football teams Outputs (aouDie) An M5 array representing the updated stats cant wat for the next season to start However, instead of wartng around for the next oobal season, you decide to take manes no your own mands and create a MATLAB ucton wil deternine which teams will be among the top compettons for the Super Bow LIN In Function Deecription You will be given an Nxs amay of staswth each row representing an NFL eam Each of the columns will represent from let to rignt, the torowing 1) Average points per game 2 Average rushing yaros per game,3) Average passing yards per game, 4) Total number of t downs, and 5) Total number of penates in order to soroughy anaryze these eams you must make the tolowing changes to he stans anay 1. Append a new ooiumn to e ignt of e anay at contains te average total yaros per ae Gacuiated by aading togetmer the average nuaing yaras and average passing yaros 3. Remove the coumn representing the ot number or irst downs Gort the rows in oescending oroer by e verage number ot points per game ebest points per game Exampe PATY 1263 2363 385 3626 Notes If there ae an odd nnber ofteams remaning beore step 5, emain in the array There wil not be any bes for average points per game betaeen teams * m se team ud
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
