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

Save Save ** You need matlab or at least just write out the code ** 2. Gaussian

ID: 2084481 • Letter: S

Question

SaveSave

** You need matlab or at least just write out the code **

2. Gaussian Elimination in Matlab In this problem we test the performance of the the naive Gaussian elimination procedure and compare it with the linear system solver implemented in Matlab (which uses scaled partial pivoting). As a test problem, we solve the system Ax b where A is the Vandermonde-matrix: co 1 C1 cn 1. where c Ico, ci,...,c] is a given vector. Since the main point of this problem is to compare the two algorithms, we choose a vector b which gives a known solution. x. For example, if the solution is x ones(n) [1,1, 11, then the load vector is b A ones (n) Solve the above system with two different algorithms: The naive Gaussian elimination without pivoting, using the function naiv-gauss (A,b), which you can find in Section 6.5. Gaussian elimination with pivoting in Matlab, i.e., using the command x Alb You should test it for the following 3 cases: 0.2 0.4,0.6, 0.8, 1 ii) c 1.0.2.0.3 0.9, 1

Explanation / Answer

Matlab script:

1) =============================

c=0.2:0.2:1;
A=vander(c)
xsol=ones(1,length(c))
B=A*xsol'

================================

2) =============================

c=0.1:0.1:1;
A=vander(c)
xsol=ones(1,length(c))
B=A*xsol'

================================

3) =============================

c=0.05:0.05:1;
A=vander(c)
xsol=ones(1,length(c))
B=A*xsol'

================================

Sample output: for (1)

============================

>>GAUSSchegg

A =

0.0016 0.0080 0.0400 0.2000 1.0000
0.0256 0.0640 0.1600 0.4000 1.0000
0.1296 0.2160 0.3600 0.6000 1.0000
0.4096 0.5120 0.6400 0.8000 1.0000
1.0000 1.0000 1.0000 1.0000 1.0000


xsol =

1 1 1 1 1


B =

1.2496
1.6496
2.3056
3.3616
5.0000

AB

ans =

1.0000
1.0000
1.0000
1.0000
1.0000

==========================

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