Matrix Matlab - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Matrix Matlab

simmyboysimmyboy Posts: 1Member
Can someone help me annotate the 4 required field, im totally lost, I HATE MY SCH!

Appendix A: Code for Assignment Question 3

function x = Gauss(A, b)
% Solve linear system Ax = b
% using Gaussian elimination without pivoting
% A is an n by n matrix
% b is an n by k matrix (k copies of n-vectors)
% x is an n by k matrix (k copies of solution vectors)

[n, k] = size(b); % Annotate this
x = b; % Annotate this
for i = 1:n-1
m = -A(i+1:n,i)/A(i,i); % Annotate this
A(i+1:n,:) = A(i+1:n,:) + m*A(i,:); %Annotate this
b(i+1:n,:) = b(i+1:n,:) + m*b(i,:);

% Use back substitution to find unknowns
x(n,:) = b(n,:)/A(n,n);
for i = n-1:-1:1
x(i,:) = (b(i,:) - A(i,i+1:n)*x(i+1:n,:))/A(i,i);

Sign In or Register to comment.