Posted By:
23 Mar, 2013 12:12 pm PDT

finding a minimum and maximum value in a matrix

I have a matrix A = [1 2 3; 10 5 6; -1 0 11]. I want to write a program that will output six things:

1. Maximum value in a matrix, which is 11
2. Minimum value in a matrix, which is -1
3. Maximum value of in the 1st row, which is 3
4. Minimum value of in the 1st row, which is 1
5. Maximum value of in the 1st column, which is 10
6. Minimum value of in the 1st column, which is -1

Attachment:None


you have to use max and min commands in MATLAB

1. Maximum value in a matrix, which is 11, type

>>D = max(max(A));

2. Minimum value in a matrix, which is -1

>>D = min(min(A));

3. Maximum value of in the 1st row, which is 3

>>D=max(A(1,:));

4. Minimum value of in the 1st row, which is 1

>>D=min(A(1,:));

5. Maximum value of in the 1st column, which is 10

>>D =max(A(:,1));

6. Minimum value of in the 1st column, which is -1

>>D =min(A(:,1));

Please watch the video and attached file for details

Attachment: min_max_matrix.m
Was it useful?  




Please login to reply to this problem.