Question
Positive numbers (7 - 10 min) Check that each value in the matrix is a positive number. Create formatted output for the number of nonpositive
Positive numbers (7 - 10 min) Check that each value in the matrix is a positive number. Create formatted output for the number of nonpositive (≤ 0) values found. For each nonpositive value, prompt the user to replace it with a positive whole number. If the user does not enter a valid number, continue prompting the user until a positive whole number is entered. Once the entire matrix has been checked, save the matrix to MA6_Task3.csv.
TASK 4: Determine magic square classification (10 - 20 min) Determine if the matrix is a form of magic square. Each criterion below defines a classification of magic square. If none of the criteria are met, produce a warning informing the user that they have not entered a magic square, and ask the user if they wish to try entering a new matrix. Rerun the entire program if the user chooses to enter a new matrix.
Determine the classification of the magic square using the following requirements:
- 1. If each row and column sum to the same value (the magic constant), the magic square is classified as "semi-magic"
2. If, in addition to criterion 1, both diagonals sum to the same value as the rows and columns, the magic square is classified as "normal"
3. If, in addition to criteria 1 and 2, the values in the square are only the sequence of numbers from 1 to ???? 2 (for example, the values in a 3x3 square would be 1:9, and for a 4x4 square would be 1:16), the magic square is classified as "perfect"
need matlab code
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