SlideShare a Scribd company logo
CHAPTER 1     MATLAB EXERCISES   1–1



CHAPTER 1   ❑   MATLAB EXERCISES

                       1. Consider the linear system of Example 7 in Section 1.2.
                            x 2y 3z            9
                            x 3y               4
                           2x 5y 5z           17
                              (a) Use the MATLAB command rref to solve the system.
                              (b) Let A be the coefficient matrix of the system, and B the right-hand side.
                                                  1            2            3                 9
                                  A               1            3            0       B         4
                                                  2            5            5                17
                                  Use the MATLAB command AB to solve the system.
                       2. Enter the matrix
                                     3        2            4            5       1
                          A          3        0            2            2       0
                                     9        4            6           12       2
                          Use the MATLAB command rref(A) to find the reduced row-echelon form of A. What is the
                          solution to the linear system represented by the augmented matrix A?
                       3. Solve the linear system
                             16x       120y       240z    140w          4
                            120x 1200y 2700z 1680w                     60
                            240x 2700y 6480z 4200w                    180
                            140x 1680y 4200z 2800w                    140
                          You can display more significant digits of the answer by typing format long before solving the
                          system. Return to the standard format by typing format short.
                       4. Use the MATLAB command rref(A) to determine which of the following matrices are row-
                          equivalent to
                                 1        2            3            4
                          B      5        6            7            8 .
                                 9       10           11           12
                             1           1            1            1                1    3         2     4           12   11   10   9
                         (a) 1           0            1            2            (b) 5    6         7     8     (c)    4    3    2   1
                             0           1            2            3                9   10        11    12            8    7    6   5

                       5. Let A be the coefficient matrix, and B the right-hand side of the linear system of equations
                           3x 3y 12z            6
                            x     y     4z      2
                           2x 5y 20z 10
                            x 2y        8z      4.
                          Enter the matrices A and B, and form the augmented matrix C for this system by using the
                          MATLAB command C [A B]. Solve the system using rref.
1–2   CHAPTER 1   SYSTEMS OF LINEAR EQUATIONS


                              6. The MATLAB command polyfit allows you to fit a polynomial of degree n 1 to a set of n data
                                 points in the plane
                                  x1, y1 ,    x2, y2 ,   . . .,     xn, yn .
                                 Find the fourth-degree polynomial that fits the five data points of Example 2 in Section 1.3 by letting
                                         2              3
                                         1              5
                                 x       0         y    1
                                         1              4
                                         2             10
                                 and entering the MATLAB command polyfit(x,y,4).
                              7. Find the second-degree polynomial that fits the points 1, 2 , 2, 4 ,        4, 6 .
                              8. Find the sixth-degree polynomial that fits the seven points 0, 0 ,              1, 4.5 ,      2, 133 ,
                                    3, 1225.5 , 1, 0.5 , 2, 3 , 3, 250.5 .
                              9. The following table gives the world population in billions for five different years.

                                 Year        Population
                                               (in billions)

                                 1960        3.0

                                 1970        3.7

                                 1975        4.1

                                 1980        4.5

                                 1985        4.8

                                 Use p polyfit x,y,4 to fit the fourth-degree polynomial to this data. Then use f polyval p,1990
                                 to estimate the world population for the year 1990. (The actual world population in 1990 was 5.3
                                 billion.)

More Related Content

PDF
Day 1 intro to functions
PDF
Equivalentfraction
PDF
Ss matlab solved
PDF
Algebra 2 Unit 5 Day 1
DOCX
Linear functions station 3
PDF
Day 4 examples
PPTX
Basic of octave matlab programming language
Day 1 intro to functions
Equivalentfraction
Ss matlab solved
Algebra 2 Unit 5 Day 1
Linear functions station 3
Day 4 examples
Basic of octave matlab programming language

Similar to Ml01 (20)

PPT
Introduction to matlab
PDF
MATLAB Questions and Answers.pdf
PPTX
Matlab-1.pptx
PDF
Matlab quick quide3.4
PDF
Assignment4
PPT
Matlab introduction
PDF
Matlab
PDF
Matlab lab exe
PDF
Matlab booklet
PPTX
COMPANION TO MATRICES SESSION II.pptx
PPT
Matlab practical and lab session
PDF
Tutorial2
DOC
matlab Lesson 1
DOCX
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
PDF
INTRODUCTION TO MATLAB session with notes
PDF
1-1 Algebra Review HW
PDF
PPTX
Multiplying Monomials
DOCX
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
PPT
Introduction to MATLAB
Introduction to matlab
MATLAB Questions and Answers.pdf
Matlab-1.pptx
Matlab quick quide3.4
Assignment4
Matlab introduction
Matlab
Matlab lab exe
Matlab booklet
COMPANION TO MATRICES SESSION II.pptx
Matlab practical and lab session
Tutorial2
matlab Lesson 1
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
INTRODUCTION TO MATLAB session with notes
1-1 Algebra Review HW
Multiplying Monomials
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
Introduction to MATLAB
Ad

Ml01

  • 1. CHAPTER 1 MATLAB EXERCISES 1–1 CHAPTER 1 ❑ MATLAB EXERCISES 1. Consider the linear system of Example 7 in Section 1.2. x 2y 3z 9 x 3y 4 2x 5y 5z 17 (a) Use the MATLAB command rref to solve the system. (b) Let A be the coefficient matrix of the system, and B the right-hand side. 1 2 3 9 A 1 3 0 B 4 2 5 5 17 Use the MATLAB command AB to solve the system. 2. Enter the matrix 3 2 4 5 1 A 3 0 2 2 0 9 4 6 12 2 Use the MATLAB command rref(A) to find the reduced row-echelon form of A. What is the solution to the linear system represented by the augmented matrix A? 3. Solve the linear system 16x 120y 240z 140w 4 120x 1200y 2700z 1680w 60 240x 2700y 6480z 4200w 180 140x 1680y 4200z 2800w 140 You can display more significant digits of the answer by typing format long before solving the system. Return to the standard format by typing format short. 4. Use the MATLAB command rref(A) to determine which of the following matrices are row- equivalent to 1 2 3 4 B 5 6 7 8 . 9 10 11 12 1 1 1 1 1 3 2 4 12 11 10 9 (a) 1 0 1 2 (b) 5 6 7 8 (c) 4 3 2 1 0 1 2 3 9 10 11 12 8 7 6 5 5. Let A be the coefficient matrix, and B the right-hand side of the linear system of equations 3x 3y 12z 6 x y 4z 2 2x 5y 20z 10 x 2y 8z 4. Enter the matrices A and B, and form the augmented matrix C for this system by using the MATLAB command C [A B]. Solve the system using rref.
  • 2. 1–2 CHAPTER 1 SYSTEMS OF LINEAR EQUATIONS 6. The MATLAB command polyfit allows you to fit a polynomial of degree n 1 to a set of n data points in the plane x1, y1 , x2, y2 , . . ., xn, yn . Find the fourth-degree polynomial that fits the five data points of Example 2 in Section 1.3 by letting 2 3 1 5 x 0 y 1 1 4 2 10 and entering the MATLAB command polyfit(x,y,4). 7. Find the second-degree polynomial that fits the points 1, 2 , 2, 4 , 4, 6 . 8. Find the sixth-degree polynomial that fits the seven points 0, 0 , 1, 4.5 , 2, 133 , 3, 1225.5 , 1, 0.5 , 2, 3 , 3, 250.5 . 9. The following table gives the world population in billions for five different years. Year Population (in billions) 1960 3.0 1970 3.7 1975 4.1 1980 4.5 1985 4.8 Use p polyfit x,y,4 to fit the fourth-degree polynomial to this data. Then use f polyval p,1990 to estimate the world population for the year 1990. (The actual world population in 1990 was 5.3 billion.)