Question

In: Economics

Part 1: (Due March 21, 2018 by 8 am) Start by writing a function (with comments)...

Part 1: (Due March 21, 2018 by 8 am) Start by writing a function (with comments) to achieve these: Determine if the matrix A is square. Augment A and b. Find the maximum absolute value in the first column and the row number that this belongs to. Interchange the first row with the row with the maximum first-column-entry. (To achieve this, create a sub-function that interchanges two specified rows for any matrix.) Submit a single m-file with a subfunction that switches rows. Complete project: Reduce the matrix into row-echelon form, using Gaussian elimination with partial pivoting (generalize the steps in Part 1 as they apply to all columns, so that the largest absolute of the values on the active column is used as the pivot.) Program to make all values below the pivot zero. Bring the system into a reduced row echelon form. Obtain x as a column matrix. Submit a single m-file with two subfunctions which switch rows and do row reduction. Label your program lastname_firstinit_ME3430_Project2.m. Use comments on the side of each line to explain the purpose of that line. NOTES ? Some built in functions to use: error, size, abs, max and the usual for, while, if structures. Ask before you use other built-in functions. ? Use for-loops instead of MATLAB vectorization. (Do not use the ":" operator to access matrix locations.) ? Test your function with various square and rectangular matrices. ? Include comments. ? Suppress all displaying of intermediate results other than the error messages that your program generates, such as “Error: the matrix is not square”, and “Error: No unique solution exists”.

Solutions

Expert Solution

Please find the program for the same.

Here I am getting assigning the values of a by myself, you can get it from the user .

Please find the code below

a=[2 1 -1 2 5
4 5 -3 6 9
4 2 -2 9 8
4 11 -4 8 2];

%Gauss elimination method [m,n)=size(a);
[m,n]=size(a); % to get the size of a, i.e, getting the coordinates
for j=1:m-1 % the outer loop to iterate over the rows in a
for z=j+1:m % the inner loop to iterate over the columns in a
if a(j,j)==0
t=a(j,:);a(j,:)=a(z,:); % getting the data in temp variable
a(z,:)=t; % copying back to a
end
end
for i=j+1:m
a(i,:)=a(i,:)-a(j,:)*(a(i,j)/a(j,j));
end
end
x=zeros(1,m);
for s=m:-1:1
c=0;
for k=2:m
c=c+a(s,k)*x(k);
end
x(s)=(a(s,n)-c)/a(s,s); % stroing the result in output variable
end
disp('Gauss elimination method:');
a % prtinting a
x' % printing output

Sample output

a =

   2   1  -1   2   5
   0   3  -1   2  -1
   0   0   1  -2  -5
   0   0   0   5  -2

ans =

   1.00000
  -2.00000
  -5.80000
  -0.40000

Related Solutions

On March 1, 2018, E Corp. issued $1,000,000 of 10% nonconvertible bonds at 103, due on...
On March 1, 2018, E Corp. issued $1,000,000 of 10% nonconvertible bonds at 103, due on February 28, 2028. Each $1,000 bond was issued with 30 detachable stock warrants, each of which entitled the holder to purchase, for $50, one share of Evan's $25 par common stock. On March 1, 2018, the market price of each warrant was $4. By what amount should the bond issue proceeds increase shareholders' equity?
The HST/GST return is due on March 31, 2019 for reporting period Dec.1, 2018 to Feb....
The HST/GST return is due on March 31, 2019 for reporting period Dec.1, 2018 to Feb. 28, 2019.   Required: Round all answers to the nearest DOLLAR. –COMPLETE and HAND IN the ATTACHED WORKSHEETS Prepare the journal entries to record the payment/refund of GST/HST (see attachment 2) Sales information: Invoice amount Includes all applicable taxes, unless otherwise stated. Assume customers are in Ontario unless otherwise noted.                                                                                                                                                    Invoice Date   Invoice #        Customer Name                                                                                      Invoice Amount Dec. 4, 2018      11100       ...
On January 1, 2018, Vandenplas issues $800,000 of 8% bonds, due in ten years, with interest...
On January 1, 2018, Vandenplas issues $800,000 of 8% bonds, due in ten years, with interest payable semiannually on June 30 and December 31 each year. Assuming the market interest rate on the issue date is 9%, the bonds will issue at $747,968. Record the bond issue on January 1, 2018, and the first four semi-annual interest payments on June 30, 2018, December 31, 2018, June 30, 2019, and December 31, 2019.
22. On January 1, 2018, Splash City issues $490,000 of 8% bonds, due in 15 years,...
22. On January 1, 2018, Splash City issues $490,000 of 8% bonds, due in 15 years, with interest payable semiannually on June 30 and December 31 each year. Assuming the market interest rate on the issue date is 7%, the bonds will issue at $535,061. Required: 1. Complete the first three rows of an amortization table. Date Cash Paid Interest Expense Decrease in Carrying Value Carrying Value 1/1/18 6/30/18 12/31/18 2. Record the bond issue on January 1, 2018, and...
STAT 2023 Assignment 8 Fall 2019 due by 10pm on Monday, October 21 Estimation of the...
STAT 2023 Assignment 8 Fall 2019 due by 10pm on Monday, October 21 Estimation of the Population Mean, Lesson 13 Whitmore Farms sells theAmeraucana hens who lay light blue eggs. A random sample of 64 of these hens produced a mean standing height of 14.4 inches. The standard deviation of standing height of Ameraucana hens is known to be .8 inch. Use this information to answer the rest of the questions on this assignment. 1. What is the point estimate...
Function writing: 1). (1 point) Write the prototype of a value-returning function checkIfOdd. This function takes...
Function writing: 1). (1 point) Write the prototype of a value-returning function checkIfOdd. This function takes three integer parameters. It returns true if all three of the parameters are odd, and false otherwise. 2). (1 point) Write a sample call for this function. (Assume that you are calling from main) 3). (3 points) Write the definition (header and body) of the function.
Problem 21-5 Statement of cash flows; direct method [LO21-3, 21-8] Comparative balance sheets for 2018 and...
Problem 21-5 Statement of cash flows; direct method [LO21-3, 21-8] Comparative balance sheets for 2018 and 2017 and a statement of income for 2018 are given below for Metagrobolize Industries. Additional information from the accounting records of Metagrobolize also is provided. METAGROBOLIZE INDUSTRIES Comparative Balance Sheets December 31, 2018 and 2017 ($ in 000s) 2018 2017 Assets Cash $ 400 $ 205 Accounts receivable 390 210 Inventory 540 360 Land 550 515 Building 900 900 Less: Accumulated depreciation (300 )...
Problem 21-18 Statement of cash flows; indirect method [LO21-4, 21-8] The comparative balance sheets for 2018...
Problem 21-18 Statement of cash flows; indirect method [LO21-4, 21-8] The comparative balance sheets for 2018 and 2017 and the income statement for 2018 are given below for Arduous Company. Additional information from Arduous’s accounting records is provided also. ARDUOUS COMPANY Comparative Balance Sheets December 31, 2018 and 2017 ($ in millions) 2018 2017 Assets Cash $ 146 $ 96 Accounts receivable 205 224 Investment revenue receivable 23 19 Inventory 222 215 Prepaid insurance 21 28 Long-term investment 203 140...
Problem 21-5 Statement of cash flows; direct method [LO21-3, 21-8] Comparative balance sheets for 2018 and...
Problem 21-5 Statement of cash flows; direct method [LO21-3, 21-8] Comparative balance sheets for 2018 and 2017 and a statement of income for 2018 are given below for Metagrobolize Industries. Additional information from the accounting records of Metagrobolize also is provided. METAGROBOLIZE INDUSTRIES Comparative Balance Sheets December 31, 2018 and 2017 ($ in 000s) 2018 2017 Assets Cash $ 530 $ 255 Accounts receivable 650 340 Inventory 800 425 Land 600 555 Building 900 900 Less: Accumulated depreciation (200 )...
Exercise 21-8 (Part Level Submission) Fuqua Company’s sales budget projects unit sales of part 198Z of...
Exercise 21-8 (Part Level Submission) Fuqua Company’s sales budget projects unit sales of part 198Z of 10,900 units in January, 12,800 units in February, and 13,100 units in March. Each unit of part 198Z requires 4 pounds of materials, which cost $3 per pound. Fuqua Company desires its ending raw materials inventory to equal 40% of the next month’s production requirements, and its ending finished goods inventory to equal 20% of the next month’s expected unit sales. These goals were...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT