Question: Using Matlab, write a function that receive a matrix (eg. function matrix(N). Then do error-checking check whether the matrix N inputted by the user is

Using Matlab, write a function that receive a matrix (eg. function matrix(N).

Then do error-checking check whether the matrix N inputted by the user is n*n square matrix and if it is not a square matrix (such as 3*2,2*3),loop until a square matrix is received.

Judge whether the matrix received is a upper triangular matrix using istriu in Matlab and print the results(fprintf('The matrix is an upper triangular matrix').

example:

matrix([1,2,3;4,5,6;7,8,9]

The matrix is not an upper triangular matrix.

matrix([1,2;3,4;5,6])

It is not a square matrix. Please try again.

matrix([1,2,3;0,5,6;0,0,9])

The matrix is an upper triangular matrix.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!