Question: function B = myPivot ( A , i , j ) % myPivot - Pivots a matrix A at entry ( i , j )

function B = myPivot(A,i,j)
%myPivot - Pivots a matrix A at entry (i,j).
%
% B = myPivot(A,i,j) produces a matrix B that is row equivalent to A
% where B(:,j)=0 except for B(i,j)=1.
%
% Inputs:
% A - a matrix
% i - row index to pivot
% j - column index to pivot
%
% Outputs:
% B - a matrix that is row equivalent to A and has been pivotted about
% entry (i,j).
%
[m,n]= size(A);
B = A;
B(i,:)= B(i,:)./B(i,j);
for row =1:m
if row == i
continue
end
B(row,:)= B(row,:)- B(row,j).*B(i,:);
end
end
Whta are the missing lines to get the correct code to answer the following
*close all;
clear all;
%% Welcome to LAB 2
% In lab2 we will write code to reduce a matrix to row echelon form. In
% particular, we will make functions that pivot an entry of a matrix and
% reduce matrices to reduced row echelon form.
%
% In class we saw how to use:
%- boolean operations (True False)
%- use if-then logic
%- write custom functions
%- access custom functions
%
%% Pivoting
% Please finish your myPivot code and ensure that it works properly
A =[[3428];[1-2510];[3-158]];
myPivot(A,1,1)
myPivot(A,2,3)
%% Questions
% #1: Please manually pivot A, around A(1,1) and A(2,3). What answer do you
% expect?
%
% Answer:
%
% #2: Does your function myPivot return the correct answer?
%
% Answer: ***********************Please make sure not long just simple and accurate******

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 Programming Questions!