HW2 - function result=IsMagic(inputMatrix) . IsMagic inputs...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Math98 HW2 : due September 15 A magic square 1 is a square array of positive integers whose columns, rows, and diagonals sum to the same number. For example, the arrays 8 1 6 3 5 7 4 9 2 1 14 14 4 11 7 6 9 8 10 10 5 13 2 3 15 17 24 1 8 15 23 5 7 14 16 4 6 13 20 22 10 12 19 21 3 11 18 25 2 9 are all magic squares. To see more examples of magic squares, use the MATLAB command magic(n) where n 3 is an integer. Design a MATLAB function of the form
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: function result=IsMagic(inputMatrix) . IsMagic inputs a square matrix inputMatrix and outputs result which is 1 if inputMatrix is magic and is 0 otherwise. You may NOT use a for or while loop for this exercise . Remark: Your solution should consist of the MATLAB code you wrote for the IsMagic function. 1 See Wikipedia for more on magic squares....
View Full Document

This note was uploaded on 01/21/2012 for the course MATH 98 taught by Professor Instuctor during the Spring '08 term at University of California, Berkeley.

Ask a homework question - tutors are online