b. Create a new section of your code titled Part 2. Copy the code provided in...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
b. Create a new section of your code titled "Part 2." Copy the code provided in Exercise 3 to perform back substition on the upper triangular augmented matrix obtained from Part 1. Display the resulting solution vector to the Command Window. Use format long to show all significant digits of this matrix. Exercise 3. (CS1.6) Suppose U is a mx (m + 1) augmented, upper triangular matrix that represents a triangular linear system with m equations and m unknowns. Assuming the entries along the main diagonal of U are nonzero, we can perform back substitution on U to obtain the unique solution to the linear system. In MATLAB, the code that performs back substitution is given below. % Back substitution on a m by m+1 upper triangular matrix U. [m, n] = size (U); x = U(:,m+1); % Initialize column vector of unknowns (to be updated). x (m) = U(m, m+1)/U(m, m); % Solve last equation of augmented matrix. for im-1:-1:1 % i counts down from m-1 to 1 in intervals of 1. SUM = 0; for = i +1:m SUM SUM + U(i, j)*x(j); end x(i) = (U(i,n) SUM) /U(i, i); % Updates the ith entry of x. end Multi-Step Problem Note: This problem will involve programming. Please attach your code and its output to the end of your homework assignment. Suppose we have a linear system with m equations and m unknowns. Let A be the mxm co- efficient matrix associated with this system, and b be the mx 1 column vector of knowns. The following MATLAB code performs regular Gaussian elimination on this system, when possible. M = [A, b]; [m, n] = size (M); for j = 1:m if M(j, j)==0 error('System cannot be solved by regular Gaussian elimination. '); end for i j+1:m = 1_ij M(i, j:n) end end M(i, j)/M(j, j); = M(i, j:n)-1_ij*M(j, j:n); To test out this algorithm, let's consider the following linear system: -2 1 0 0 1 1 0 U2 2 1 0 -2 1 30-40 63 0 1 -2 1 0 U5 -2 1 0 0 0 1 -2 For those familiar with numerical methods for ordinary differential equations, the system above is a finite-difference discretization of the boundary value problem Ju" = x |u(0) = u(1) = 0 5 0 < x < 1 with five equally spaced interior nodes. Remark: the coefficient matrix above is called a tridiagonal matrix because all of its nonzero entries are concentrated along the three main diagonals of the matrix. a. Create a new script in MATLAB called hw2_msp.m. In your new script, create a section ti- tled "Part 1." In this section, copy the provided code to perform regular Gaussian elimination on the augmented matrix that represents the linear system above. In your code, display the resulting upper triangular augmented matrix to the Command Window. Use format long to show all significant digits of this matrix. b. Create a new section of your code titled "Part 2." Copy the code provided in Exercise 3 to perform back substition on the upper triangular augmented matrix obtained from Part 1. Display the resulting solution vector to the Command Window. Use format long to show all significant digits of this matrix. Exercise 3. (CS1.6) Suppose U is a mx (m + 1) augmented, upper triangular matrix that represents a triangular linear system with m equations and m unknowns. Assuming the entries along the main diagonal of U are nonzero, we can perform back substitution on U to obtain the unique solution to the linear system. In MATLAB, the code that performs back substitution is given below. % Back substitution on a m by m+1 upper triangular matrix U. [m, n] = size (U); x = U(:,m+1); % Initialize column vector of unknowns (to be updated). x (m) = U(m, m+1)/U(m, m); % Solve last equation of augmented matrix. for im-1:-1:1 % i counts down from m-1 to 1 in intervals of 1. SUM = 0; for = i +1:m SUM SUM + U(i, j)*x(j); end x(i) = (U(i,n) SUM) /U(i, i); % Updates the ith entry of x. end Multi-Step Problem Note: This problem will involve programming. Please attach your code and its output to the end of your homework assignment. Suppose we have a linear system with m equations and m unknowns. Let A be the mxm co- efficient matrix associated with this system, and b be the mx 1 column vector of knowns. The following MATLAB code performs regular Gaussian elimination on this system, when possible. M = [A, b]; [m, n] = size (M); for j = 1:m if M(j, j)==0 error('System cannot be solved by regular Gaussian elimination. '); end for i j+1:m = 1_ij M(i, j:n) end end M(i, j)/M(j, j); = M(i, j:n)-1_ij*M(j, j:n); To test out this algorithm, let's consider the following linear system: -2 1 0 0 1 1 0 U2 2 1 0 -2 1 30-40 63 0 1 -2 1 0 U5 -2 1 0 0 0 1 -2 For those familiar with numerical methods for ordinary differential equations, the system above is a finite-difference discretization of the boundary value problem Ju" = x |u(0) = u(1) = 0 5 0 < x < 1 with five equally spaced interior nodes. Remark: the coefficient matrix above is called a tridiagonal matrix because all of its nonzero entries are concentrated along the three main diagonals of the matrix. a. Create a new script in MATLAB called hw2_msp.m. In your new script, create a section ti- tled "Part 1." In this section, copy the provided code to perform regular Gaussian elimination on the augmented matrix that represents the linear system above. In your code, display the resulting upper triangular augmented matrix to the Command Window. Use format long to show all significant digits of this matrix.
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these databases questions
-
QUIZ... Let D be a poset and let f : D D be a monotone function. (i) Give the definition of the least pre-fixed point, fix (f), of f. Show that fix (f) is a fixed point of f. [5 marks] (ii) Show that...
-
In Fig. P2.72 gate AB is circular. Find the moment of the hydrostatic force on this gate about axis A. Neglect atmospheric pressure.
-
Write a paper on "Identifying Process to Find Employment as an ETL Developer"
-
Assume that Bon Temps has a beta coefficient of 1.2, that the risk-free rate (the yield on T-bonds) is 7%, and that the required rate of return on the market is 12%. What is Bon Tempss required rate...
-
Consider the Latin Square design and data from Bliss and Rose [1940] shown in Table 5.9. a. Use R to compute the ANOVA table. Interpret the results. b. Estimate the treatment effects. Interpret the...
-
Orange, Inc., a calendar year corporation in Clemson, South Carolina, elects S corporation status for 2015. The company generated a $74,000 NOL in 2014 and another NOL of $43,000 in 2015. Orange...
-
You pay $1,000 to flip a two-sided, fair coin at the local fair. If you flip 'heads', you walk away with $3,000, a return of 200%. However, if you flip 'tails', you walk away with $250, a return of...
-
An engineer has a DAQ with a 14-bit A/D converter and a voltage range of 0 to 10 V. They are measuring vibrations around 20 Hz, so they sample at f= 100 Hz to avoid aliasing. They add a DC offset of...
-
(a) In a sample of clay soil, the void ratio (e) is 0.73, solids specific gravity (G) 2.71 and degree of saturation (S) 92%. Calculate (i) the water content, and bulk and dry densities, and (ii) the...
-
49. Two charges +3 C and +12 C are fixed 1 m apart, with the second one to the right. Find the magnitude and direction of the net force on a -2-nC charge when placed at the following locations: (a)...
-
This position-time graph describes an object's motion. Use it to determine the velocity of the object between 1.5 and 2 s? 3 Position(m) 1 2 000 -4 m/s 2 m/s -2 m/s 4 m/s 0.5 15 N Ci time(s)
-
7. A spring exerts a force as shown on the graph below. a) How much work is done as the spring stretches from 20 to 40 cm? b) What is the spring constant? c) What is the change in spring potential...
-
Consider a non - rotating space station in the shape of a long thin uniform rod of mass 1 . 1 2 1 . 1 2 x 1 0 ^ 6 1 0 ^ 6 kg and length 6 2 6 6 2 6 meters. Rocket motors on both ends of the rod are...
-
The lowest sea-level pressure on Earth was measured inside a hurricane. a. True b. False
-
Hoi Chong Transport, Ltd., operates a fleet of delivery trucks in Singapore. The company has determined that if a truck is driven 105,000 kilometers during a year, the average operating cost is 11.4...
-
Smiths Family Fashions implemented a balanced scorecard performance measurement system several years ago. Smiths is a locally owned clothing retailer with fashions for men, women, teens, and...
-
How are qualified dividends taxed in 2012? Please give the two rates of tax which apply to qualified dividends, and specify when each of these rates applies._________________________...
-
Jason and Mary are married taxpayers in 2012. They are both under age 65 and in good health. For this tax year, they have a total of $41,000 in wages and $500 in interest income. Jason and Mary's...
-
Leslie is a single taxpayer who is under age 65 and in good health. For 2012, she has a salary of $23,000 and itemized deductions of $1,000. Leslie is entitled to one exemption on her tax return. a....
-
When facilitating the methylation or pseudouridylation of an rRNA, a snoRNA functions as a. a decoy. b. a scaffold. c. a guide. d. both b and c.
-
When an ncRNA functions as a decoy, it a. contains binding sites for many different proteins, thereby promoting the formation of a large complex. b. recognizes other ncRNAs and sequesters them,...
-
Suppose that the overexpression of a particular miRNA was associated with pancreatic cancer. Which of the following agents might be effective in treating this type of cancer? a. Enoxacin b. A DNA...
Study smarter with the SolutionInn App