Need Help on Matlab! For the followingtwo problems, create two codes for each. T
ID: 1716749 • Letter: N
Question
Need Help on Matlab!
For the followingtwo problems, create two codes for each. The first way is to use the simple Matlab matrix algebra rules i, e. if you're multiplying a matrix L by a vectorxi, it's just L* xi. For the second way create for loops that perform the same multiplication ofd-schoofstyle. m not asking youto program this in C, but knowing how to write the matrix multiplication in afor loop is good practice forless matrix- friendly languages (C Java, etc). 1. Code up the Jacobi Method as presented in lecture and use it to solve the large matrix of problem 4. Returnthe iteration count to solve this problem and a plot of the solution. 2. Modify the Jacobi methodto use the most current information e, implement the Gauss-Seidel method) and solve problem 4 once more. Againinclude the iteration count and solution plot. Problem 4 3 -13 9 30 (x1) (-19) (-6 4 1 18) (x2)- (-34) 6 2 2 4) (x3) (16) (12 8 6 10) (x4) (26) Jacobi Example A (2 3-1; 1 -2 1; 1-1 11; b 13 1 11 [1 -2 1; 2 3 -1 b (1 3 1] ANb U triu (A, 1) L tril (A, -1) D diag (diag (A)) Di inv (D); eps le 3 err 1; [0 0 0] while err eps Di (b- (L+U) *x) Xn err max (abs (xn x)) disp ('Iteration num2str(i) error num2str (err) i i 1 endExplanation / Answer
and:
Answer 2.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.