Problem 56503. Cricket - Career Bowling Statistics
Given a vector s of strings representing a bowler's individual innings records, return their career statistics as a 3-element (numeric) row vector representing: average, strike rate, and economy rate. The strings will be in the standard form: "O-M-R-W", such as "31.4-8-123-4" to represent 31 overs and 4 balls, 8 maidens, 123 runs conceded, 4 wickets taken.
Note that overs can be given as integers ("31" meaning 31 complete overs) or as pseudo decimals ("31.4" meaning 31 overs and 4 balls). All overs can be assumed to be 6-balls. All other statistics will be integers.
Career statistics are defined as:
- Average = (total runs conceded) / (total wickets taken)
- SR = (total balls delivered) / (total wickets taken)
- Econ = (total runs conceded) / (total overs delivered)
(Note that economy is given as runs/over. However, it can be calculated as runs/ball then converted to runs/over, assuming 6 balls/over.)
For example:
s = ["23.1-8-55-5";"24-5-84-0"];
stats = bowlingstats(s)
stats =
27.8000 56.6000 2.9470
Here, the bowler has delivered 47.1 overs (= 47*6 + 1 = 282 + 1 = 283 balls), conceded 139 runs, and taken 5 wickets. Hence their average is 139/5 = 27.8, their strike rate is 283/5 = 56.6, and their economy rate is 139/47.1667 = 2.947. (Or equivalently, economy = 139/283 = 0.4912 runs/ball, which converts to 0.4912*6 = 2.947 runs/over.)
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers26
Suggested Problems
-
Make the vector [1 2 3 4 5 6 7 8 9 10]
49319 Solvers
-
Fix the last element of a cell array
1341 Solvers
-
1641 Solvers
-
特定の値がベクトル内に含まれているかを確認するコードを書こう
308 Solvers
-
Calculate supply voltage and total current
148 Solvers
More from this Author22
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!