Question: USING MATLAB (30p) Write a program that asks the user to enter a number between 1 and 7, representing the day of a week. If
USING MATLAB
(30p) Write a program that asks the user to enter a number between 1 and 7, representing the day of a week. If the user enters any other number not within this range, the program should show an error and ask the user to re-run the program manually. Then, it should create a square matrix based on the number entered by the user. The matrix should have the following properties: The first column of the matrix should include the squareroot of the number entered by the user. The last column of the matrix should include the number entered by the user. The remaining elements of the matrix, should be decided based on the following rule: If the summation of the matrix indices (i,j) is less than or equal to the entered number itself, it should be the calculated as the summation of the indices. Otherwise, it should be the largest indice's number. . O O For example; if the user entered 4, the program should create the following 4x4 matrix. 2 3 4 4 2 4 3 4 2 3 3 4 L2 4 4 4. Then, it should show the following message: The matrix that you constructed for the 4th day is as follows: -2 3 4 2 4 4 2 3 4 12 4 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
