SlideShare a Scribd company logo
1 of 2
Download to read offline
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

Similar to Ml01

Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlabkrishna_093
 
MATLAB Questions and Answers.pdf
MATLAB Questions and Answers.pdfMATLAB Questions and Answers.pdf
MATLAB Questions and Answers.pdfahmed8651
 
COMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptxCOMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptximman gwu
 
Matlab practical and lab session
Matlab practical and lab sessionMatlab practical and lab session
Matlab practical and lab sessionDr. Krishna Mohbey
 
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docxCSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docxmydrynan
 
INTRODUCTION TO MATLAB session with notes
  INTRODUCTION TO MATLAB   session with  notes  INTRODUCTION TO MATLAB   session with  notes
INTRODUCTION TO MATLAB session with notesInfinity Tech Solutions
 
1-1 Algebra Review HW
1-1 Algebra Review HW1-1 Algebra Review HW
1-1 Algebra Review HWnechamkin
 
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docxSAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docxanhlodge
 

Similar to Ml01 (20)

Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
MATLAB Questions and Answers.pdf
MATLAB Questions and Answers.pdfMATLAB Questions and Answers.pdf
MATLAB Questions and Answers.pdf
 
Matlab-1.pptx
Matlab-1.pptxMatlab-1.pptx
Matlab-1.pptx
 
Matlab quick quide3.4
Matlab  quick quide3.4Matlab  quick quide3.4
Matlab quick quide3.4
 
Assignment4
Assignment4Assignment4
Assignment4
 
Matlab introduction
Matlab introductionMatlab introduction
Matlab introduction
 
Matlab
MatlabMatlab
Matlab
 
Matlab lab exe
Matlab lab exeMatlab lab exe
Matlab lab exe
 
Matlab booklet
Matlab bookletMatlab booklet
Matlab booklet
 
COMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptxCOMPANION TO MATRICES SESSION II.pptx
COMPANION TO MATRICES SESSION II.pptx
 
Matlab practical and lab session
Matlab practical and lab sessionMatlab practical and lab session
Matlab practical and lab session
 
Tutorial2
Tutorial2Tutorial2
Tutorial2
 
matlab Lesson 1
matlab Lesson 1matlab Lesson 1
matlab Lesson 1
 
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docxCSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
 
INTRODUCTION TO MATLAB session with notes
  INTRODUCTION TO MATLAB   session with  notes  INTRODUCTION TO MATLAB   session with  notes
INTRODUCTION TO MATLAB session with notes
 
1-1 Algebra Review HW
1-1 Algebra Review HW1-1 Algebra Review HW
1-1 Algebra Review HW
 
Matlab
MatlabMatlab
Matlab
 
Multiplying Monomials
Multiplying MonomialsMultiplying Monomials
Multiplying Monomials
 
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docxSAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
SAMPLE QUESTIONExercise 1 Consider the functionf (x,C).docx
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
 

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.)