Fourier Series

Total Page:16

File Type:pdf, Size:1020Kb

Fourier Series Matrices 4: use of MATLAB Anthony Rossiter http://controleducation.group.shef.ac.uk/indexwebbook.html http://www.shef.ac.uk/acse Department of Automatic Control and Systems Engineering Introduction • The previous videos introduced definitions of matrices, basic notation and special cases such as square matrices, symmetry and vectors and concepts of addition and subtraction. • This video shows how MATLAB can be used to define and store matrices, to extract specified components and for addition/subtraction. Matlab environment The main thing to note is that the default variable in MATLAB is a matrix (or vector if the row or column dimension is one). Any BODMAS type operation that is valid with matrices can be carried out with the same syntax. MATLAB also includes a large number of matrix analysis tools that you will find useful. This video introduces the basics. Defining a matrix Matrices are defined by their rows and columns. Data entry into MATLAB can be managed by defining the rows or columns. MATLAB SYNTAX: Columns are separated by commas (or spaces) and rows are separated by semi-colons. I advise against using spaces in general as these are not always obvious and lead to silly typos. MATLAB SYNTAX example Entry of a 2 by 3 matrix. Define 1st row separating elements by commas. Then semi-colon, followed by 2nd row separated by commas. MATLAB SYNTAX example 2 Entry of a 3 by 6 matrix. Define each row in turn separating elements by commas. Use a semi-colon between rows. Interim summary Data entry in this fashion is somewhat clumsy and tedious. • It may be easier to allocate values directly, especially where a matrix is sparse. • Some common matrices are predefined in MATLAB and hence shortcuts are provided. Create a matrix with following information 2nd row and 3rd column is 5 4th row and 2nd column is 2 1st row and 5th column is 6 Remainder are 0. Note MATLAB syntax matches that used in mathematics, i.e. row index and then column index. Modifying matrix elements When a matrix already exists, you can edit a coefficient directly by accessing its position. Modifying matrix dimensions When a matrix already exists, you can change its dimension by specifying a new coefficient. Unknown coefficients are automatically filled with zeros. Extracting coefficients Individual coefficients can be extracted using equivalent notation. Specify the row and column of the element desired. Extracting whole row/column MATLAB provides shortcuts so that you can quickly extract whole rows or columns. Matrix Transposition In MATLAB transposition is defined using two alternatives, here an apostrophe or the file transpose.m WARNING: THE use of the apostrophe only gives transpose for real matrices as in fact it gives complex conjugate transpose. A common coding errors is to forget this subtlety. Examples of transposition Example of NOT transposition Complex conjugate transpose! Special matrices MATLAB has shortcuts for: 1. identify matrices. 2. matrices of zeros. 3. matrices of ones. 4. diagonal matrices. Also has shortcuts to produce random matrices and other specialised forms not discussed here. Identity matrix - must define required dimension Matrix of ones – must define required dimensions Matrix of zeros – must define required dimensions Diagonal matrix – supply diagonal elements Addition and subtraction of matrices Add (or subtract) components in same position, that is with the same {row, column} index. C A B Ci, j Ai, j Bi, j Matrices must be same dimensions or you cannot add them! 2 3 1 2 3 5 A ; B ; A B 3 4 7 6 4 2 MATLAB handles matrix addition/subtraction automatically using normal + and - notation Addition example 1 Addition example 2 Addition example 3 Using matrices to store data A common use of a matrix in MATLAB is to store tabular data. One in a matrix, it is easy to use MATLAB commands to plot this data as required. MATLAB example 30 25 20 Temperature Voltage 15 10 5 0 0 20 40 60 80 100 120 Time (sec) JUMP TO MATLAB FOR QUICK LIVE DEMONSTRATION File is called matrixentry.m Summary • Demonstrated the core matrix capability of MATLAB. • Variables in MATLAB are automatically interpreted as matrices. • Normal matrix algebra rules apply. • Coefficients are defined and accessed using the index of (row,column) .
Recommended publications
  • Math 223 Symmetric and Hermitian Matrices. Richard Anstee an N × N Matrix Q Is Orthogonal If QT = Q−1
    Math 223 Symmetric and Hermitian Matrices. Richard Anstee An n × n matrix Q is orthogonal if QT = Q−1. The columns of Q would form an orthonormal basis for Rn. The rows would also form an orthonormal basis for Rn. A matrix A is symmetric if AT = A. Theorem 0.1 Let A be a symmetric n × n matrix of real entries. Then there is an orthogonal matrix Q and a diagonal matrix D so that AQ = QD; i.e. QT AQ = D: Note that the entries of M and D are real. There are various consequences to this result: A symmetric matrix A is diagonalizable A symmetric matrix A has an othonormal basis of eigenvectors. A symmetric matrix A has real eigenvalues. Proof: The proof begins with an appeal to the fundamental theorem of algebra applied to det(A − λI) which asserts that the polynomial factors into linear factors and one of which yields an eigenvalue λ which may not be real. Our second step it to show λ is real. Let x be an eigenvector for λ so that Ax = λx. Again, if λ is not real we must allow for the possibility that x is not a real vector. Let xH = xT denote the conjugate transpose. It applies to matrices as AH = AT . Now xH x ≥ 0 with xH x = 0 if and only if x = 0. We compute xH Ax = xH (λx) = λxH x. Now taking complex conjugates and transpose (xH Ax)H = xH AH x using that (xH )H = x. Then (xH Ax)H = xH Ax = λxH x using AH = A.
    [Show full text]
  • COMPLEX MATRICES and THEIR PROPERTIES Mrs
    ISSN: 2277-9655 [Devi * et al., 6(7): July, 2017] Impact Factor: 4.116 IC™ Value: 3.00 CODEN: IJESS7 IJESRT INTERNATIONAL JOURNAL OF ENGINEERING SCIENCES & RESEARCH TECHNOLOGY COMPLEX MATRICES AND THEIR PROPERTIES Mrs. Manju Devi* *Assistant Professor In Mathematics, S.D. (P.G.) College, Panipat DOI: 10.5281/zenodo.828441 ABSTRACT By this paper, our aim is to introduce the Complex Matrices that why we require the complex matrices and we have discussed about the different types of complex matrices and their properties. I. INTRODUCTION It is no longer possible to work only with real matrices and real vectors. When the basic problem was Ax = b the solution was real when A and b are real. Complex number could have been permitted, but would have contributed nothing new. Now we cannot avoid them. A real matrix has real coefficients in det ( A - λI), but the eigen values may complex. We now introduce the space Cn of vectors with n complex components. The old way, the vector in C2 with components ( l, i ) would have zero length: 12 + i2 = 0 not good. The correct length squared is 12 + 1i12 = 2 2 2 2 This change to 11x11 = 1x11 + …….. │xn│ forces a whole series of other changes. The inner product, the transpose, the definitions of symmetric and orthogonal matrices all need to be modified for complex numbers. II. DEFINITION A matrix whose elements may contain complex numbers called complex matrix. The matrix product of two complex matrices is given by where III. LENGTHS AND TRANSPOSES IN THE COMPLEX CASE The complex vector space Cn contains all vectors x with n complex components.
    [Show full text]
  • Complex Inner Product Spaces
    MATH 355 Supplemental Notes Complex Inner Product Spaces Complex Inner Product Spaces The Cn spaces The prototypical (and most important) real vector spaces are the Euclidean spaces Rn. Any study of complex vector spaces will similar begin with Cn. As a set, Cn contains vectors of length n whose entries are complex numbers. Thus, 2 i ` 3 5i C3, » ´ fi P i — ffi – fl 5, 1 is an element found both in R2 and C2 (and, indeed, all of Rn is found in Cn), and 0, 0, 0, 0 p ´ q p q serves as the zero element in C4. Addition and scalar multiplication in Cn is done in the analogous way to how they are performed in Rn, except that now the scalars are allowed to be nonreal numbers. Thus, to rescale the vector 3 i, 2 3i by 1 3i, we have p ` ´ ´ q ´ 3 i 1 3i 3 i 6 8i 1 3i ` p ´ qp ` q ´ . p ´ q « 2 3iff “ « 1 3i 2 3i ff “ « 11 3iff ´ ´ p ´ qp´ ´ q ´ ` Given the notation 3 2i for the complex conjugate 3 2i of 3 2i, we adopt a similar notation ` ´ ` when we want to take the complex conjugate simultaneously of all entries in a vector. Thus, 3 4i 3 4i ´ ` » 2i fi » 2i fi if z , then z ´ . “ “ — 2 5iffi — 2 5iffi —´ ` ffi —´ ´ ffi — 1 ffi — 1 ffi — ´ ffi — ´ ffi – fl – fl Both z and z are vectors in C4. In general, if the entries of z are all real numbers, then z z. “ The inner product in Cn In Rn, the length of a vector x ?x x is a real, nonnegative number.
    [Show full text]
  • C*-Algebras, Classification, and Regularity
    C*-algebras, classification, and regularity Aaron Tikuisis [email protected] University of Aberdeen Aaron Tikuisis C*-algebras, classification, and regularity C*-algebras The canonical C*-algebra is B(H) := fcontinuous linear operators H ! Hg; where H is a (complex) Hilbert space. B(H) is a (complex) algebra: multiplication = composition of operators. Operators are continuous if and only if they are bounded (operator) norm on B(H). ∗ Every operator T has an adjoint T involution on B(H). A C*-algebra is a subalgebra of B(H) which is norm-closed and closed under adjoints. Aaron Tikuisis C*-algebras, classification, and regularity C*-algebras The canonical C*-algebra is B(H) := fcontinuous linear operators H ! Hg; where H is a (complex) Hilbert space. B(H) is a (complex) algebra: multiplication = composition of operators. Operators are continuous if and only if they are bounded (operator) norm on B(H). ∗ Every operator T has an adjoint T involution on B(H). A C*-algebra is a subalgebra of B(H) which is norm-closed and closed under adjoints. Aaron Tikuisis C*-algebras, classification, and regularity C*-algebras The canonical C*-algebra is B(H) := fcontinuous linear operators H ! Hg; where H is a (complex) Hilbert space. B(H) is a (complex) algebra: multiplication = composition of operators. Operators are continuous if and only if they are bounded (operator) norm on B(H). ∗ Every operator T has an adjoint T involution on B(H). A C*-algebra is a subalgebra of B(H) which is norm-closed and closed under adjoints. Aaron Tikuisis C*-algebras, classification, and regularity C*-algebras The canonical C*-algebra is B(H) := fcontinuous linear operators H ! Hg; where H is a (complex) Hilbert space.
    [Show full text]
  • Commutative Quaternion Matrices for Its Applications
    Commutative Quaternion Matrices Hidayet H¨uda KOSAL¨ and Murat TOSUN November 26, 2016 Abstract In this study, we introduce the concept of commutative quaternions and commutative quaternion matrices. Firstly, we give some properties of commutative quaternions and their Hamilton matrices. After that we investigate commutative quaternion matrices using properties of complex matrices. Then we define the complex adjoint matrix of commutative quaternion matrices and give some of their properties. Mathematics Subject Classification (2000): 11R52;15A33 Keywords: Commutative quaternions, Hamilton matrices, commu- tative quaternion matrices. 1 INTRODUCTION Sir W.R. Hamilton introduced the set of quaternions in 1853 [1], which can be represented as Q = {q = t + xi + yj + zk : t,x,y,z ∈ R} . Quaternion bases satisfy the following identities known as the i2 = j2 = k2 = −1, ij = −ji = k, jk = −kj = i, ki = −ik = j. arXiv:1306.6009v1 [math.AG] 25 Jun 2013 From these rules it follows immediately that multiplication of quaternions is not commutative. So, it is not easy to study quaternion algebra problems. Similarly, it is well known that the main obstacle in study of quaternion matrices, dating back to 1936 [2], is the non-commutative multiplication of quaternions. In this sense, there exists two kinds of its eigenvalue, called right eigenvalue and left eigenvalue. The right eigenvalues and left eigenvalues of quaternion matrices must be not the same. The set of right eigenvalues is always nonempty, and right eigenvalues are well studied in literature [3]. On the contrary, left eigenvalues are less known. Zhang [4], commented that the set of left eigenvalues is not easy to handle, and few result have been obtained.
    [Show full text]
  • Unitary-And-Hermitian-Matrices.Pdf
    11-24-2014 Unitary Matrices and Hermitian Matrices Recall that the conjugate of a complex number a + bi is a bi. The conjugate of a + bi is denoted a + bi or (a + bi)∗. − In this section, I’ll use ( ) for complex conjugation of numbers of matrices. I want to use ( )∗ to denote an operation on matrices, the conjugate transpose. Thus, 3 + 4i = 3 4i, 5 6i =5+6i, 7i = 7i, 10 = 10. − − − Complex conjugation satisfies the following properties: (a) If z C, then z = z if and only if z is a real number. ∈ (b) If z1, z2 C, then ∈ z1 + z2 = z1 + z2. (c) If z1, z2 C, then ∈ z1 z2 = z1 z2. · · The proofs are easy; just write out the complex numbers (e.g. z1 = a+bi and z2 = c+di) and compute. The conjugate of a matrix A is the matrix A obtained by conjugating each element: That is, (A)ij = Aij. You can check that if A and B are matrices and k C, then ∈ kA + B = k A + B and AB = A B. · · You can prove these results by looking at individual elements of the matrices and using the properties of conjugation of numbers given above. Definition. If A is a complex matrix, A∗ is the conjugate transpose of A: ∗ A = AT . Note that the conjugation and transposition can be done in either order: That is, AT = (A)T . To see this, consider the (i, j)th element of the matrices: T T T [(A )]ij = (A )ij = Aji =(A)ji = [(A) ]ij. Example. If 1 2i 4 1 + 2i 2 i 3i ∗ − A = − , then A = 2 + i 2 7i .
    [Show full text]
  • Lecture No 9: COMPLEX INNER PRODUCT SPACES (Supplement) 1
    Lecture no 9: COMPLEX INNER PRODUCT SPACES (supplement) 1 1. Some Facts about Complex Numbers In this chapter, complex numbers come more to the forefront of our discussion. Here we give enough background in complex numbers to study vector spaces where the scalars are the complex numbers. Complex numbers, denoted by ℂ, are defined by where 푖 = √−1. To plot complex numbers, one uses a two-dimensional grid Complex numbers are usually represented as z, where z = a + i b, with a, b ℝ. The arithmetic operations are what one would expect. For example, if If a complex number z = a + ib, where a, b R, then its complex conjugate is defined as 푧̅ = 푎 − 푖푏. 1 9 Л 2 Комплексний Евклідов простір. Аксіоми комплексного скалярного добутку. 10 ПР 2 Обчислення комплексного скалярного добутку. The following relationships occur Also, z is real if and only if 푧̅ = 푧. If the vector space is ℂn, the formula for the usual dot product breaks down in that it does not necessarily give the length of a vector. For example, with the definition of the Euclidean dot product, the length of the vector (3i, 2i) would be √−13. In ℂn, the length of the vector (a1, …, an) should be the distance from the origin to the terminal point of the vector, which is 2. Complex Inner Product Spaces This section considers vector spaces over the complex field ℂ. Note: The definition of inner product given in Lecture 6 is not useful for complex vector spaces because no nonzero complex vector space has such an inner product.
    [Show full text]
  • Numerical Linear Algebra
    University of Alabama at Birmingham Department of Mathematics Numerical Linear Algebra Lecture Notes for MA 660 (1997{2014) Dr Nikolai Chernov Summer 2014 Contents 0. Review of Linear Algebra 1 0.1 Matrices and vectors . 1 0.2 Product of a matrix and a vector . 1 0.3 Matrix as a linear transformation . 2 0.4 Range and rank of a matrix . 2 0.5 Kernel (nullspace) of a matrix . 2 0.6 Surjective/injective/bijective transformations . 2 0.7 Square matrices and inverse of a matrix . 3 0.8 Upper and lower triangular matrices . 3 0.9 Eigenvalues and eigenvectors . 4 0.10 Eigenvalues of real matrices . 4 0.11 Diagonalizable matrices . 5 0.12 Trace . 5 0.13 Transpose of a matrix . 6 0.14 Conjugate transpose of a matrix . 6 0.15 Convention on the use of conjugate transpose . 6 1. Norms and Inner Products 7 1.1 Norms . 7 1.2 1-norm, 2-norm, and 1-norm . 7 1.3 Unit vectors, normalization . 8 1.4 Unit sphere, unit ball . 8 1.5 Images of unit spheres . 8 1.6 Frobenius norm . 8 1.7 Induced matrix norms . 9 1.8 Computation of kAk1, kAk2, and kAk1 .................... 9 1.9 Inequalities for induced matrix norms . 9 1.10 Inner products . 10 1.11 Standard inner product . 10 1.12 Cauchy-Schwarz inequality . 11 1.13 Induced norms . 12 1.14 Polarization identity . 12 1.15 Orthogonal vectors . 12 1.16 Pythagorean theorem . 12 1.17 Orthogonality and linear independence . 12 1.18 Orthonormal sets of vectors .
    [Show full text]
  • PHYSICS 116A Homework 8 Solutions 1. Boas, Problem 3.9–4
    PHYSICS 116A Homework 8 Solutions 1. Boas, problem 3.9–4. Given the matrix, 0 2i 1 − A = i 2 0 , − 3 0 0 find the transpose, the inverse, the complex conjugate and the transpose conjugate of A. Verify that AA−1 = A−1A = I, where I is the identity matrix. We shall evaluate A−1 by employing Eq. (6.13) in Ch. 3 of Boas. First we compute the determinant by expanding in cofactors about the third column: 0 2i 1 − i 2 det A i 2 0 =( 1) − =( 1)( 6) = 6 . ≡ − − 3 0 − − 3 0 0 Next, we evaluate the matrix of cofactors and take the transpose: 2 0 2i 1 2i 1 − − 0 0 − 0 0 2 0 0 0 2 i 0 0 1 0 1 adj A = − − − = 0 3 i . (1) − 3 0 3 0 − i 0 − 6 6i 2 i 2 0 2i 0 2i − − − 3 0 − 3 0 i 2 − According to Eq. (6.13) in Ch. 3 of Boas the inverse of A is given by Eq. (1) divided by det(A), so 1 0 0 3 −1 1 i A = 0 2 6 . (2) 1 i 1 − − 3 It is straightforward to check by matrix multiplication that 0 2i 1 0 0 1 0 0 1 0 2i 1 1 0 0 − 3 3 − i 2 0 0 1 i = 0 1 i i 2 0 = 0 1 0 . − 2 6 2 6 − 3 0 0 1 i 1 1 i 1 3 0 0 0 0 1 − − 3 − − 3 The transpose, complex conjugate and the transpose conjugate∗ can be written down by inspec- tion: 0 i 3 0 2i 1 0 i 3 − − − ∗ † AT = 2i 2 0 , A = i 2 0 , A = 2i 2 0 .
    [Show full text]
  • More Matlab Some Matlab Operations Matlab Allows You to Do Various
    More Matlab Some Matlab operations Matlab allows you to do various matrix operations easily. For example: • rref(A) is the reduced row echelon form of A. • A*x is the matrix product. • A’ is the transpose of A (actually the conjugate transpose if A is complex). • inv(A) is the inverse of A. • If k = 1, 2, 3,... then A∧k is Ak. • x = A\b solves Ax = b • A*B is the matrix product AB of two appropriately sized matrices. • If c is a scalar then c*B is the scalar multiple cB. More operations on matrices If A is a matrix then max(A) gives a row vector whose entries are the maxima of the entries in each column of A. Likewise, sum(A) gives a row vector whose entries are the sum of the entries in each column of A.1 You could sum the row entries of A by using the transpose, (sum(A’))’ will produce a column vector whose entries are the sum of each row of A. Some other operations are prod(A) for the product of the column entries and min(A) for the minimum. Transpose and complex matrices If A is a complex matrix then A0 is not the transpose, but the conjugate transpose. The conjugate transpose is obtained from the transpose by taking the complex conjugate of each entry, which means you change the sign of the imaginary part. For complex matrices, the conjugate transpose is generally more useful than the transpose but if you actually want the transpose of a complex matrix A then conj(A’) or A.’ will calculate it.
    [Show full text]
  • C*-Algebraic Schur Product Theorem, P\'{O} Lya-Szeg\H {O}-Rudin Question and Novak's Conjecture
    C*-ALGEBRAIC SCHUR PRODUCT THEOREM, POLYA-SZEG´ O-RUDIN˝ QUESTION AND NOVAK’S CONJECTURE K. MAHESH KRISHNA Department of Humanities and Basic Sciences Aditya College of Engineering and Technology Surampalem, East-Godavari Andhra Pradesh 533 437 India Email: [email protected] August 17, 2021 Abstract: Striking result of Vyb´ıral [Adv. Math. 2020] says that Schur product of positive matrices is bounded below by the size of the matrix and the row sums of Schur product. Vyb´ıral used this result to prove the Novak’s conjecture. In this paper, we define Schur product of matrices over arbitrary C*- algebras and derive the results of Schur and Vyb´ıral. As an application, we state C*-algebraic version of Novak’s conjecture and solve it for commutative unital C*-algebras. We formulate P´olya-Szeg˝o-Rudin question for the C*-algebraic Schur product of positive matrices. Keywords: Schur/Hadamard product, Positive matrix, Hilbert C*-module, C*-algebra, Schur product theorem, P´olya-Szeg˝o-Rudin question, Novak’s conjecture. Mathematics Subject Classification (2020): 15B48, 46L05, 46L08. Contents 1. Introduction 1 2. C*-algebraic Schur product, Schur product theorem and P´olya-Szeg˝o-Rudin question 3 3. Lower bounds for C*-algebraic Schur product 7 4. C*-algebraic Novak’s conjecture 9 5. Acknowledgements 11 References 11 1. Introduction Given matrices A := [aj,k]1≤j,k≤n and B := [bj,k]1≤j,k≤n in the matrix ring Mn(K), where K = R or C, the Schur/Hadamard/pointwise product of A and B is defined as (1) A ◦ B := aj,kbj,k .
    [Show full text]
  • Eigenvalues & Eigenvectors
    Eigenvalues & Eigenvectors Eigenvalues and Eigenvectors Eigenvalue problem (one of the most important problems in the linear algebra) : If A is an n×n matrix, do there exist nonzero vectors x in Rn such that Ax is a scalar multiple of x? (The term eigenvalue is from the German word Eigenwert , meaning “proper value”) Eigenvalue Geometric Interpretation A: an n×n matrix λ: a scalar (could be zero ) x: a nonzero vector in Rn Eigenvalue Ax= λ x Eigenvector 2 Eigenvalues and Eigenvectors Example 1: Verifying eigenvalues and eigenvectors. 2 0 1 0 A = x = x = 0 −1 1 0 2 1 Eigenvalue 201 2 1 In fact, for each eigenvalue, it has infinitely many eigenvectors. Ax1 = ===2 2 x 1 010− 0 0 For λ = 2, [3 0]T or [5 0]T are both corresponding eigenvectors. Eigenvector Moreover, ([3 0] + [5 0]) T is still an eigenvector. Eigenvalue The proof is in Theorem. 7.1. 200 0 0 Ax= = =−1 =− ( 1) x 2 011− − 1 1 2 Eigenvector 3 Eigenspace Theorem 7.1: (The eigenspace corresponding to λ of matrix A) If A is an n×n matrix with an eigenvalue λ, then the set of all eigenvectors of λ together with the zero vector is a subspace of Rn. This subspace is called the eigenspace of λ. Proof: x1 and x2 are eigenvectors corresponding to λ (i.e., Ax1=λ x 1, A x 2 = λ x 2 ) (1) A (xx12+=+ ) A xx 1 A 2 =+=λ xx 12 λ λ ( xx 12 + ) (i.e., x1+ x 2 is also an eigenvector corr esponding to λ) (2)( Acx1 )= cA ( x 1 ) = c (λ x 1 ) = λ ( c x 1 ) (i.e., cx1 is also an eigenvector corre sponding to λ) Since this set is closed under vector addition and scalar multiplication, this set is a subspace of Rn according to Theorem 4.5.
    [Show full text]