Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a third m-file that implements the function mySumMat (mat) that operates on a two-dimensional matrix. Use two while loops to sum up the arbitrary
Create a third m-file that implements the function mySumMat (mat) "that operates on a two-dimensional matrix. Use two while loops to sum up the arbitrary mumber of both rows and cohums in the matrix (This introduces the concept of nested loops. This function will also return a single scalar value representmg the sum of all elements in the matrix Test with matrices: [1,3,7,6;2,15,0,8] and [1,2,3; 4,5,6; 9,8,7] WAIT! YOU ARE NOT DONE - Whenever we build assumptions into our programs, we should test to ensure the assumptions are valid. In this case, we ASSUME the imput is a vector or matrix. The proper way to code this is to TEST to make sure they are vectors or matrices. If mySum ) ormyAve () are not passed a vector, return the error message ERROR: input must be one-dimensional vector. Consider all possibilities! If mySumMat () is not passed a 2-D array, return "ERROR: mput must be a two- dimensional matrix. These assumptions must ALSO be documented in the help
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