Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function [matrix, Min_matrix,Max_matrix,Sum,Tmatrix,multi_matrix] = project4(m,n,Min,Max)
- m = input('ammount of rows in the matrix: ');
- n = input('amount of columns in the matrix: ');
- Max = input('highest nr in your matrix: ');
- Min = input('lowest nr in your matrix: ');
- % first Question: Create your Matrix
- matrix = randi( [Min Max], m , n )
- % 2nd Question: The addition of all the matrixยดs numbers
- % Hand typed: sum(sum(ans))
- Sum = sum(sum(matrix))
- %3rd Question: Transpose and multiply your matrix
- % Hand typed: transpose(ans)
- Tmatrix = transpose(matrix)
- multi_matrix = Tmatrix * matrix
- %4th Question: Find the Minimum and Maximum nr in matrix
- % Hand typed: max(max(ans)) and min(min(ans))
- Min_matrix = min(min(matrix))
- Max_matrix = max(max(matrix))
- % %5th: rewrite all Min and Max numbers with Inf & -inf
- matrix(matrix == Max_matrix) = inf;
- matrix(matrix == Min_matrix) = -inf;
- %6th Question: replace all odd numbers in your matrix with NAN
- % Hand typed: ans(rem(ans,2) == 1) = NaN;
- matrix(rem(matrix,2) == 1) = NaN;
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement