正在加载图片...
MATLAB Lecture 2 School of Mathematical Sciences Xiamen University http∥gdjpkc.xmu.edu.cr ☆ MATLAB MATLAB Solves such linear equations without computing the inverse of the matrix The two division symbols, slash, / and backslash, \, are used for the two situations where the unknown matrix appears on the left or right of the coefficient matrix. X-AIB Denotes the solution to the matrix equation AX=B X= B/A Denotes the solution to the matrix equation XA=B The coefficient matrix A need not be square. If A is m-by-n, there are three cases m=n Square system. Seek an exact solution. m>oVerdetermined system. Find a least squares solution. m < n Underdetermined system. Find a basic solution with at most m nonzero components The backslash operator employs different algorithms to handle different kinds of coefficient matrices. The various cases, which are diagnosed automatically by examining the coefficient matrix include Permutations of triangular matrices Symmetric, positive definite matrices Square, nonsingular matrices Rectangular, overdetermined systems Rectangular, underdetermined systems General Solution The general solution to a system of linear equations AX =b describes all possible solutions. You can find the general solution by Step 1. Solving the corresponding homogeneous system AX =0. Do this using the null command, by typing null(A). This returns a basis for the solution space to AX=0. Any solution is a linear combination of basis vectors Step 2. Finding a particular solution to the non-homogeneous system AX=b You can then write any solution to AX= b as the sum of the particular solution to AX-b, from step 2, plus a linear combination of the basis vectors from step 1 Nonsingular Coefficient Matrix(can be verified by det or rank functions >>A= pascal( 3): % Obtain a Pascal matrix >>u=[3;1;4 >>x=Alu %Try x=pinv(A)*u, xiv(A*A)*A*u Lec2MATLAB Lecture 2  School of Mathematical Sciences Xiamen University  http://gdjpkc.xmu.edu.cn  Lec2­2  ² MATLAB MATLAB solves such linear equations without computing the inverse of the matrix.  The two division symbols, slash, /,  and  backslash, \, are used for the two situations where the unknown matrix appears on the left or right of the coefficient matrix.  X = A\B Denotes the solution to the matrix equation AX = B.  X = B/A Denotes the solution to the matrix equation XA = B.  The coefficient matrix A need not be square. If A is m­by­n, there are three cases.  m = n Square system. Seek an exact solution.  m > n Overdetermined system. Find a least squares solution.  m < n Underdetermined system. Find a basic solution with at most m nonzero components.  The backslash operator employs different  algorithms  to handle different  kinds of coefficient  matrices.  The various  cases,  which are diagnosed automatically by examining the coefficient  matrix, include:  Permutations of triangular matrices  Symmetric, positive definite matrices  Square, nonsingular matrices  Rectangular, overdetermined systems  Rectangular, underdetermined systems  General Solution  The general solution to a system of linear equations AX = b describes all possible solutions. You  can find the general solution by:  Step 1.  Solving the corresponding homogeneous  system AX  =  0.  Do this using the null command, by typing null(A). This returns a basis for the solution space to AX = 0. Any solution is a linear combination of basis vectors.  Step 2. Finding a particular solution to the non­homogeneous system AX = b.  You can then write any solution to AX = b as the sum of the particular solution to AX = b, from  step 2, plus a linear combination of the basis vectors from step 1.  Nonsingular Coefficient Matrix (can be verified by det or rank functions )  >> A = pascal(3);  % Obtain a Pascal matrix  >> u = [3; 1; 4];  >> x = A\u  % Try x=pinv(A)*u; x=inv(A’*A)*A’*u  x =
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有