(adsbygoogle = window.adsbygoogle || []).push({}); 1. The problem statement, all variables and given/known data

Let A be the nxn matrix with elements a_{ij}= -1 for i > j, a_{ii}= a_{in}= 1, 1 <= i <= n, and zero everywhere else. Let b be a random vector. Solve the linear system Ax = b by Gaussian Elimination with partial pivoting.

Use tril, eye, and ones to generate A,

Generate b with rand.

No loops

2. Relevant equations

3. The attempt at a solution

I'm not sure if this is the correct place to post this, but I figured someone in Computer Science might know MATLAB and be able to help. For one, I am HORRIBLE with MATLAB. I never seem to be able to do it exactly the way my teacher expects it. First off, I'm having trouble generating A. So far, I've used G = eye(n,n) to get a matrix with 1's on the diagonal, and C = tril(-ones(n,n),-1) to get a matrix with -1's where I think they should be. However, I still need a way to get 1's in the last column. Also, I'm not sure how to put these three matrixes together in MATLAB to construct A.

Another thing, I know for G.E.P.P. we need to factor A = PLU. I am assuming for this particular matrix, those will be obvious? Maybe I am wrong. Then, I guess I just have to solve Ly = P^{T}b and Ux = y.

I'm really just not good with MATLAB, as this is the first class I've ever had to use it for. I've tried reading up on it, and although I generally get the desired outcome, my method never seems to be correct. It would be greatly appreciated if someone could give me some guidance on this problem. Thank you so much.

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Homework Help: MATLAB - Gaussian Elimination with Partial Pivoting

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

**Physics Forums | Science Articles, Homework Help, Discussion**