Help me with code in MATLAB
Budget: $30 – $250 USD
Code so far:
function B = GaussElim(A,s)
m=size(A,1);
n=size(A,2);
fileID=fopen(s,'a+');
fprintf(fileID,'original matrix is the following:\n');
for i=1:m
for j=1:n
fprintf(fileID, '%5.2f\t', A(i,j));
end
fprintf(fileID,'\n');
end
fclose(fileID);
After this, I need the code to be able to take any size matrix and:
1.) Divide each row of the matrix by its leading entry, unless the leading entry is 0
2.) If the first row has a leading entry of 0, swap with a row that has a leading entry of 1
3.) Subtract all rows with a leading entry of 1 that are below the first row by the first row, making the first column have all zeros besides the first entry
function B = GaussElim(A,s)
m=size(A,1);
n=size(A,2);
fileID=fopen(s,'a+');
fprintf(fileID,'original matrix is the following:\n');
for i=1:m
for j=1:n
fprintf(fileID, '%5.2f\t', A(i,j));
end
fprintf(fileID,'\n');
end
fclose(fileID);
After this, I need the code to be able to take any size matrix and:
1.) Divide each row of the matrix by its leading entry, unless the leading entry is 0
2.) If the first row has a leading entry of 0, swap with a row that has a leading entry of 1
3.) Subtract all rows with a leading entry of 1 that are below the first row by the first row, making the first column have all zeros besides the first entry