Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use Matlab and attach all Matlab codes to solve (Coding Practice) Write a MATLAB

ID: 3683300 • Letter: U

Question

Use Matlab and attach all Matlab codes to solve

(Coding Practice) Write a MATLAB function that takes a matrix A as input,
and nds the minimum element from this matrix and its corresponding row index
and column index. The function header is:
function [minele, row, col]= ndminele(A)
where the input A is a matrix, and the output minele is the minimum element in
A, and the outputs row and col are the corresponding row and column indices of
minele. (Note: you are NOT allowed to use the built-in MATLAB function min
here.)

Explanation / Answer

Code:

function [minele, row, col]= findminele(A)
   [m,n]=size(A);
   minele=A(1,1);
   row=1;
   col=1;
   for i=1:m
       for j=1:n
           if (minele>A(i,j)):
               minele=A(i,j);
               row=i;
               col=j;
       end
   end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote