Question: For all MATLAB codes written, appropriate comments are re- quired. Solutions must be uploaded in PDF format to Canvas. 1. A common problem in practical

For all MATLAB codes written, appropriate comments are re- quired. Solutions must be uploaded in PDF format to Canvas. 1. A common problem in practical computations is to take an array and sort it in some fashion. There are many solutions to this problem, but you will focus on the Bubble Sort. It is not a very efficient method, but it does allow us to develop some important skills. Bubble sort works by comparing neighboring elements in a array, and if necessary, interchange the elements. We might call one pass through the array of this operation " percolate." The bubble sort is completed when, after some number of "percolate" passes, the array is guaranteed to be sorted. (a) Develop a flowchart, using the symbols given in class, that represents this algorithm (b) Express your algorithm in pseudo-code. (c) Implement your algorithm in a MATLAB function or functions. 2. Draw a flowchart for a function that finds the index of the maximum absolute value within a range of indices in an array. For example, if we had the array [1 0 -12 14 7], and we called the function with the range 1,3, the function would return 3 as the index of the location of the number -12. If the function was called with the range 2,5, the function would return 4, the location of 14. 3. Draw a flowchart that interchanges two rows in a matrix. Note that you already implemented this function in Homework 1. 4. Draw a flowchart to pivot a matrix, if necessary. The flowchart should use the functions represented by Parts 1 and 2. 5. Draw a flowchart to compute a linear combination of two rows in a matrix, replacing one of the rows with the combination. 6. Using the functions represented by Parts 4 and 5, draw a flowchart to reduce a matrix to upper-triangular form. 7. How would you modify the algorithm in Part 6 to prepare a linear system of equations for back-substitution? 8. Write a pseudo-code algorithm to perform back-substitution on a system of equations in upper-triangular form. 9. Implement a set of MATLAB functions that represent each of the opera- tions in Parts 2-8 to solve a linear ssytem of equations. For all MATLAB codes written, appropriate comments are re- quired. Solutions must be uploaded in PDF format to Canvas. 1. A common problem in practical computations is to take an array and sort it in some fashion. There are many solutions to this problem, but you will focus on the Bubble Sort. It is not a very efficient method, but it does allow us to develop some important skills. Bubble sort works by comparing neighboring elements in a array, and if necessary, interchange the elements. We might call one pass through the array of this operation " percolate." The bubble sort is completed when, after some number of "percolate" passes, the array is guaranteed to be sorted. (a) Develop a flowchart, using the symbols given in class, that represents this algorithm (b) Express your algorithm in pseudo-code. (c) Implement your algorithm in a MATLAB function or functions. 2. Draw a flowchart for a function that finds the index of the maximum absolute value within a range of indices in an array. For example, if we had the array [1 0 -12 14 7], and we called the function with the range 1,3, the function would return 3 as the index of the location of the number -12. If the function was called with the range 2,5, the function would return 4, the location of 14. 3. Draw a flowchart that interchanges two rows in a matrix. Note that you already implemented this function in Homework 1. 4. Draw a flowchart to pivot a matrix, if necessary. The flowchart should use the functions represented by Parts 1 and 2. 5. Draw a flowchart to compute a linear combination of two rows in a matrix, replacing one of the rows with the combination. 6. Using the functions represented by Parts 4 and 5, draw a flowchart to reduce a matrix to upper-triangular form. 7. How would you modify the algorithm in Part 6 to prepare a linear system of equations for back-substitution? 8. Write a pseudo-code algorithm to perform back-substitution on a system of equations in upper-triangular form. 9. Implement a set of MATLAB functions that represent each of the opera- tions in Parts 2-8 to solve a linear ssytem of equations
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
