Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

matlab This assignment is to implement a function to find a submatrix within a matrix. If it exists, you should return three pieces of information:

matlab

This assignment is to implement a function to find a submatrix within a matrix. If it exists, you should return three pieces of information: a count of the number of times that the submatrix appears in the matrix, and a list of x and y coordinates of where the submatrix can be found. This function could be used to find a subimage within an image, such as a watermark.

For example, suppose that we have the following matrix: 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 Where is the submatrix [9, 0; 4, 5]? You should see that it appears only once, starting at row 2, column 4. Given the above matrix and submatrix, your function should return three variables with values 1, 2, and 4. Where is the submatrix [2, 3; 7, 8]? It actually is in two locations. Your function should thus return 2, then [1, 3] (the two rows where this submatrix can be found), then [2, 2] (the two columns where this submatrix can be found). In other words, you found it at (1,2) and again at (3, 2).

Check to make sure that the submatrix is actually smaller than the matrix. If not, print a note to the user suggesting that they switch parameters, and quit gracefully.

What if the submatrix is not found? What is an appropriate response? (Oh yes, we will test for this.)

To solve your problem, write a program that reads the necessary information to compute and output the indicated values, as efficiently as possible. Design your program by specifying its behavior, identifying the variables and operations it needs to solve the problem, and then organizing the variables and operations into an algorithm. Then code your design in MATLAB using stepwise translation. Finally, test your program thoroughly.

Your function should work for all possible inputs. Make sure that you test it with several different cases. Also, your function should include in the header comments the usage, showing a working example.

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

Step: 3

blur-text-image

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

Fundamentals Of Database Systems

Authors: Sham Navathe,Ramez Elmasri

5th Edition

B01FGJTE0Q, 978-0805317558

More Books

Students also viewed these Databases questions