Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Given any square matrix M with even dimensions (2 by 2, 4 by 4, 6 by 6, and so on). a) Write a MATLAB function:

image text in transcribed
Given any square matrix M with even dimensions (2 by 2, 4 by 4, 6 by 6, and so on). a) Write a MATLAB function: fold HM= fold H(M), that will return in matrix foldHM^- a matrix that is the horizontally folded version of M. both horizontal halves of M should be summed as shown below. Given the 4 by matrix M 1 -3 2 4 5 7 8 9 6 8 21 3 3 3 3 1 -3 2 4 5 7 8 9 6 8 2 1 3 3 3 3 Calling the function foldH(M) gives the horizontally folded, 2 by 4, matrix foldHM. 4 0 5 7 11 15 10 10 Vectorize your code as much as you can. Your code should work with nay matrix of even dimensions. b) Write a MATLAB function: foldV(M) that will return in matrix "foldVM" a matrix that is the vertically folded version of M. Both vertical halves of M should be summed as shown below Given the same 4 by matrix M 1 - 3 2 4 5 7 89 6 8 2 1 3 3 3 3 Calling the function fold V(M) gives the vertically folded, 4 by 2, matrix, fold VM. 3 1 13 16 8 9 6 6 Vectorize your code as much as you can. You code should work with any matrix of even dimensions

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

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions