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

1. Write a MATLAB function that takes a matrix, a row number and a scalar as arg

ID: 3708708 • Letter: 1

Question

1. Write a MATLAB function that takes a matrix, a row number and a scalar as arguments and multiplies each element of the row of the matrix by the scalar returning the updated matrix. Use loops for the program. Do not use the : subscripting operator, e.g A2). 2. Write a MATLAB function that takes a matrix, a row number and a column number Beginning with the row number passed to the function, scan down the column passed to the function and return the row number that contains the largest absolute value in the column. For example, if your matrix is 1 9 4 5 11-2 3 0 0-6 5 4 3 5 7-3 and you pass row 2, column 2, the function should return 3. Row 3 has the largest absolute value in column 2 including and below row 2. Use loops for the program. Do not use the: operator 3. Write a function that will accept a matrix and return a matrix. The function should take the passed matrix and using Gauss Elimination put zeros in the first column of the matrix. The first step is to put the row with the largest absolute value in the first row by swapping rows using functions you have already created. Then calculate the factor necessary to multiply the first row by so that when it is added to the second row, the element in row 2 column 1 becomes zero. Use your linear combination function to accomplish this task. Then move down to the next row. Keep looping through the rows until all the elements in column 1, except row 1, are zero. The function should work with any size matrix--not necessarily square For example, if the matrix 1 9 4 5 0 -6 5 4 3 5 73 is passed to the function, the function would return

Explanation / Answer

If you post more than 1 question, as per chegg guidelines I ahve to solve only first question.

Ques 1.

-------------------------fxn.m--------------------

function [arr] = fxn(arr, row, n)

    % get the dimension of matrix

    [r , c] = size(arr);

    % traverse the row

    for i = 1 : c

      

        % multiply each element by n

        arr(row , i) = arr(row , i) * n;

       

    end

end

------------------------main.m-----------------------

arr = [ 1 : 3 ; 4 : 6 ; 7 : 9 ];

x = fxn(arr , 2 , 4);

disp(x);

Sample Output

1 2 3
16 20 24
7 8 9

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