Answered step by step
Verified Expert Solution
Question
1 Approved Answer
its a matlab assignment Question 3. Matrix Addition and Matrix-Vector Multiplication Generate vectors u and v and matrices A and B by typing u=fix(10rand(3,1)),A=fix(10rand(2,3)),v=fix(10rand(3,1)),B=fix(10rand(2,3)) These
its a matlab assignment
Question 3. Matrix Addition and Matrix-Vector Multiplication Generate vectors u and v and matrices A and B by typing u=fix(10rand(3,1)),A=fix(10rand(2,3)),v=fix(10rand(3,1)),B=fix(10rand(2,3)) These matrices have entries randomly selected from the numbers 0,1,,9. (a) To obtain a finear combination sA+tB of the matrices A and B (where s and t are real numbers) usifig MatLAB, you must type sA+tB. This is only defined when A and B are the same size. The transpose AT of A is obtained by typing A. - Calculate the following using MATLAB. A+B,B+A,6B,2(3B),6A+15B,3(2A+5B);3A(3AT)T Insert comments in your diary file that explain the properties of matrix addition and scalar multiplication that these calculations illustrate. (See Theorems 1.1 and 1.2 on pages 6 and 7 of the text.) (b) To obtain the matrix-vector product Au using MATLAB, you must type A*u (remember that a vector is just a matrix with one column). Calculate the following using MATLAB. Au+Av,A(u+v),(A+B)u,Au+Bu,A(3u),3A(u) Insert comments in your diary file that explain the properties of the matrix-vector product that these calculations illustrate. (See Theorem 1.3 on page 24 of the text.) Question 4. Gaussian Elimination and Reduced Row-Echelon Form Now that you know how to do matrix calculations with MATLAB, you can easily carry out the steps in Gaussian elimination. Before starting work on this question, type rrefmovie at the MatLAB prompt. If you get an error message ??? Undefined function or variable rrefmovie, click on Set Path on the toolbar. Insert the name of the directory where you have copied the Tcode rrefmovie. n, and save the result (you will need to do this in future labs also). You will see a step-by-step example of the row operations that transform a matrix A into its reduced row echelon form R=rref(A). In this demonstration, each pivot is chosen to be the largest in its column (for numerical stability), so extra row interchanges are used. Since rref (A) is uniquely determined by A, this does not affect the final answer. (Do not include this part in your lab write-up.) (a) Generate a 34 matrix A with random integer entries by the command A=fix(10rand(3,4)) To transform A into R=rref(A), start with R=A. Normalize the first row of R to get R(1,1)=1 : R=A;R(1,i)=R(1,i)/R(1,1) (note the use of the colon to operate on whole rows of the matrix). If your random matrix happens to have A(1,1)=0, then interchange rows to get a nonzero entry in the (1,1) position before doing the calculation above. Now subtract a multiple of the first row of R from the second row to make R(2,1)=0 : R(2,1)=R(2,i)=R(2,1)R(1,i) Repeat this procedure to make R(3,1)=0 : R(3,i)=R(3,i)R(3,1)R(1,i) (you can minimize typing by using the up-arrow key and editing the command line). The first column of your matrix R should now be the same as the first column of rref (A). (b) Operate on R by the same method as in (a) to obtain the second column of rref (A). First normalize row 2 of R, then subtract multiples of fow 2 from rows 1 and 3 to put zeros in the (1,2) and (3,2) positions (you can minimize typing by using the up-arrow key and editing the commands used in part (a)). Be sure to refer to the entries in your matrix symbolically as was done in part (a); don't type explicit decimal numbers in the MATLAB commands. to obtain the second column of rref(A). First normalize (you can minimize typing by 2 from rows 1 and 3 to put zeros in the (1,2) and (3,2) positions refer to the entries in you by using the up-arrow key and editing the commands used in part (a)). Be sure to in the MatLAB con your matrix symbolically as was done in part (a); don't type explicit decimal numbers (c) Operate on R by the same method as in (b) to obtain the third column of rref(A). First normalize row 3 of R, then subtract multiples of row 3 from rows 1 and 2 to put zeros in the (1,3) and (2,3) positions. (d) Your matrix R should now be transformed into rref(A) (since A is a random 34 matrix, rref (A) is (almost)'sure to have rank 3 ). Check your answer by MatLAB with the command rref(A). If the MATLAB answer is not the same as the current value of your R, go back and redo your calculations. Question 5. Leontief Input-Output Model Read pages 56-59 of Section 1.5 in the text and study Practice Problem 1 on page 59 and its solution on page 65. (a) Use MATLAB to create the input-output matrix C for the economy described in Exercise 22 on page 63 , as follows: Create 31 column vectors a,m, and s that correspond to the agricultural, manufacturing, and services sectors, respectively. Then set C=[a,m,s]. (b) Use the gross production vector x in part (a) of Exercise 22 and the matrix C to calculate the net production vector. Describe in words the net production (in millions of \$) of each sector of the economy. (c) Let d be the demand vector described in part (b) of Exercise 22. (i) Write (in symbolic form) the inhomogeneous equation that the gross production vector x must satisfy in order to satisfy demand d. (See the boxed statement at the top of page 59 of the text.) (ii) Use the MatLaB rref command on a suitable augmented matrix to solve the equation in (i) for x. Describe in words the gross production (in millions of \$) of each sector of the economy that are needed to satisfy the given demand d Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started