Home / Expert Answers / Computer Science / please-generate-the-function-with-matlab-code-with-the-procedure-and-do-the-exercises-to-check-the-pa735

(Solved): Please generate the function with Matlab code with the procedure. And do the exercises to check the ...



Produce a function with the following specifications:
\begin{tabular}{r|l} 
NAME: & parPivGaussElim_###\#\#\#\#\# \\
INPUT: &Gaussian Elimination with Partial Pivoting
To solve the \( n \times n \) linear system
\[
\begin{array}{cc}
E_{1}: & a_{11} x

Please generate the function with Matlab code with the procedure.

And do the exercises to check the function can be run.

Thank you so much!!!

Produce a function with the following specifications: \begin{tabular}{r|l} NAME: & parPivGaussElim_###\#\#\#\#\# \\ INPUT: & b, A \\ OUTPUT: & \( \mathrm{x} \) \\ DESCRIPTION: & \( \mathrm{x} \) is the solution to Ax=b found using Gaussian Elimination with partial pivoting. \\ PSEUDOCODE: & Pg. 378 \end{tabular} Useful MATLAB concepts/functions - The absolute value function works on vectors and matrices as well. Let \( \mathrm{x} \) be a column vector (or a matrix). Then abs(x) returns the column vector (or matrix) with each entry being the absolute value of the corresponding entry of \( \mathrm{x} \). - Use the function \( \max () \) to get the maximum entry of a vector. - Let \( \mathrm{x} \) be a vector of dimension \( \mathrm{n} \), and let \( 1 \leq i \leq j \leq n \). To get the sub-vector consisting of the entries \( x_{i}, x_{i+1} \ldots, x_{j} \), use the MATLAB command: \[ \mathrm{x}(\mathrm{i}: \mathrm{j}) \] EXERCISES 1. Create a rounded version of parPivGaussElim, titled roundParPivGaussElim using the same technique as the previous exercise. Test roundParPivGaussElim on the system from the previous exercise and compare your results with your rounded gaussian elimination function roundGaussElim. Gaussian Elimination with Partial Pivoting To solve the \( n \times n \) linear system \[ \begin{array}{cc} E_{1}: & a_{11} x_{1}+a_{12} x_{2}+\cdots+a_{1 n} x_{n}=a_{1, n+1} \\ E_{2}: & a_{21} x_{1}+a_{22} x_{2}+\cdots+a_{2 n} x_{n}=a_{2, n+1} \\ & \vdots \\ E_{n}: & a_{n 1} x_{1}+a_{n 2} x_{2}+\cdots+a_{n n} x_{n}=a_{n, n+1} \end{array} \] INPUT number of unknowns and equations \( n \); augmented matrix \( A=\left[a_{i j}\right] \) where \( 1 \leq \) \( i \leq n \) and \( 1 \leq j \leq n+1 \). OUTPUT solution \( x_{1}, \ldots, x_{n} \) or message that the linear system has no unique solution. Step 1 For \( i=1, \ldots, n \) set \( N R O W(i)=i . \quad \) (Initialize row pointer.) Step 2 For \( i=1, \ldots, n-1 \) do Steps 3-6. (Elimination process.) Step 3 Let \( p \) be the smallest integer with \( i \leq p \leq n \) and \( |a(N R O W(p), i)|=\max _{i \leq j \leq n}|a(N R O W(j), i)| \). (Notation: \( a(N R O W(i), j) \equiv a_{N R O W_{i}, j} \).) Step 4 If \( a(N R O W(p), i)=0 \) then OUTPUT ('no unique solution exists'); STOP. Step 5 If \( N R O W(i) \neq N R O W(p) \) then set \( N C O P Y=N R O W(i) \); \( N R O W(i)=N R O W(p) ; \) \( N R O W(p)=N C O P Y \). (Simulated row interchange.) Step 6 For \( j=i+1, \ldots, n \) do Steps 7 and 8 . Step 7 Set \( m(N R O W(j), i)=a(N R O W(j), i) / a(N R O W(i), i) \). Step 8 Perform \( \left(E_{N R O W(j)}-m(\operatorname{NROW}(j), i) \cdot E_{N R O W(i)}\right) \rightarrow\left(E_{N R O W(j)}\right) \). Step 9 If \( a(N R O W(n), n)=0 \) then OUTPUT ('no unique solution exists'); STOP. 6.2 Pivoting Strategies 379 Step \( 10 \operatorname{Set} x_{n}=a(\operatorname{NROW}(n), n+1) / a(\operatorname{NROW}(n), n) \). (Start backward substitution.) Step 11 For \( i=n-1, \ldots, 1 \) \[ \text { set } x_{i}=\frac{a(N R O W(i), n+1)-\sum_{j=i+1}^{n} a(\operatorname{NROW}(i), j) \cdot x_{j}}{a(N R O W(i), i)} . \] Step 12 OUTPUT \( \left(x_{1}, \ldots, x_{n}\right) ; \) (Procedure completed successfully.) STOP.


We have an Answer from Expert

View Expert Answer

Expert Answer


clc ,clear, close; // Enter Coefficient of Matrix A i.e. Coefficient x,y,z, A = [1 2 1; 2 3 4; 4 3 2]; // Enter R.H.S. Value B = [8; 20; 16]; // Calculate Number of Row and Column n
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe