Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 9 For Linux UNIX And Windows Advanced Database Administration Certification Certification Study Guide

Authors: Roger E. Sanders, Dwaine R Snow

1st Edition

1583470808, 978-1583470800

More Books

Students also viewed these Databases questions

Question

1. How do most insects respire ?

Answered: 1 week ago

Question

Who is known as the father of the indian constitution?

Answered: 1 week ago

Question

1.explain evaporation ?

Answered: 1 week ago

Question

a. How will the leader be selected?

Answered: 1 week ago

Question

b. Will new members be welcomed?

Answered: 1 week ago