Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Modify the user-defined function GaussPivot in Program 4-2 (Example 4-3) such that in each step of the elimination the pivot row is switched with the

Modify the user-defined function GaussPivot in Program 4-2 (Example 4-3) such that in each step of the elimination the pivot row is switched with the row that has a pivot element with the largest absolute numerical value. For the function name and arguments use x = GaussPivotLarge (a,b), where a is the matrix of coefficients, b is the right-hand-side column of constants, and x is the solution.

image text in transcribed

image text in transcribed

(a) Use the GaussPivotLarge function to solve the system of linear equations in Eq. (4.17).

(b) Use the GaussPivotLarge function to solve the system:

image text in transcribed

Example 4-3: MATLAB user-defined function for solving a system of equations using Gauss elimination with pivoting. Write a user-defined MATLAB function for solving a system of linear equations [a][x] = [b] using the Gauss elimination method with piv- oting. Name the function x GaussPivot (a,b), where a is the matrix of coefficients, b is the right-hand-side column vector of con- stants, and x is a column vector of the solution. Use the function to determine the forces in the loaded eight-member truss that is shown in the figure (same as in Fig. 4-2) SOLUTION 4000 N The forces in the eight truss members are determined from the set of eight equations, Eqs. (4.2). The equations are derived by drawing free body diagrams of pins A, B, C, and D and applying equations of equilibrium. The equations are rewritten here in a matrix form (intentionally, the equations are written in an order that requires piv- oting 20m 0 0.9231 0 0 0 0 1-0.3846 0 0 0 0 1690 3625 0 0 0 0 1 0 0.8575 0 BC 1 0 0.7809 0 0 0 (4.17) 0 -0.3846 -0.7809 0 -1 0.38460 0 FCD 0 0.9231 0.6247 0 0 -0.9231 0 0F 0 0 0.6247 -1 0 0 0 0 DE 0 1 0 0-0.5145 -1 The function GaussPivot is created by modifying the function Gauss listed in the solution of Example 42 Program 4-2: User-defined function. Gauss elimination with pivoting function x = Gaus s Pivot (a, b) % The function solves a system of linear equations ax b using the Gauss % elimination method with pivoting. Input variables: % a The matrix of coefficients. % b Right-hand-side column vector of constants Output variable: % x A column vector with the s lution ab= [a,b]; [R, c] = size (ab); for j = 1:R-1 % Pivoting section starts if ab (j , j ) = = 0 Check if the pivot element is zero

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

8. Explain the relationship between communication and context.

Answered: 1 week ago

Question

d. How were you expected to contribute to family life?

Answered: 1 week ago