MATLAB Basics With a brief review of linear algebra by Lanyi Xu modified by D.G.E. Robertson.

Slides:



Advertisements
Présentations similaires
Information Theory and Radar Waveform Design Mark R. bell September 1993 Sofia FENNI.
Advertisements

Laboratoire des outils informatiques pour la conception et la production en mécanique (LICP) ÉCOLE POLYTECHNIQUE FÉDÉRALE DE LAUSANNE 1 Petri nets for.
THE ADJECTIVES: BEAU, NOUVEAU AND VIEUX 1.
Irregular Adjectives Not all adjectives are made the same.
Celebrity Photo Album by M. Rocque. La Description You are going to see several celebrities. For each celebrity say one or two adjectives to describe.
Le Passif...getting to know the Passive Voice in French!
Making PowerPoint Slides Avoiding the Pitfalls of Bad Slides.
PERFORMANCE One important issue in networking is the performance of the network—how good is it? We discuss quality of service, an overall measurement.
10/10/ Finite Difference Method Major: All Engineering Majors Authors: Autar Kaw, Charlie Barker
An Introduction To Two – Port Networks The University of Tennessee Electrical and Computer Engineering Knoxville, TN wlg.
IP Multicast Text available on
Template Provided By Genigraphics – Replace This Text With Your Title John Smith, MD 1 ; Jane Doe, PhD 2 ; Frederick Smith, MD, PhD 1,2 1.
CNC Turning Module 1: Introduction to CNC Turning.
UNEP / ICCA Workshop TEMA June DG and GHS Classification System.
1. Neal Creative | click & Learn more Neal Creative © TIP │ Use the built-in c olor palette with green and yellow for callouts and accents Neal Creative.
1MPES2 Multiply Polynomials
How to form questions in French
Formules en 2 étapes 1MPES4
Le verbe « AVOIR » To Have.
Infinitive There are 3 groups of REGULAR verbs in French: verbs ending with -ER = 1st group verbs ending with -IR = 2nd group verbs ending with -RE = 3rd.
LES PRONOMS D’OBJET DIRECT
Review of Passé Composé
Mon enfance Quand tu étais petit, tu étais comment?
l y a which we have already learned means “there is/are l y a which we have already learned means “there is/are.” When we put a measure of time.
L’impératif ( = command forms)
Les pentes sont partout.
Le Corps.
Review of Passé Composé
Reflective verbs or Pronominal verbs
Quantum Computer A New Era of Future Computing Ahmed WAFDI ??????
the Periodic Table the Periodic Table 2017/2018 Made by : NEDJAR NASSIMA Made by : NEDJAR NASSIMA MS:HAMZA 1.
Statistics & Econometrics Statistics & Econometrics Statistics & Econometrics Statistics & Econometrics Statistics & Econometrics Statistics & Econometrics.
Français I – Leçon 6A Structures
NFPA-12 Edition 2005 What “IMPACT” will the changes to NFPA-12 have on the design and installation of a CO 2 system?
© 2004 Prentice-Hall, Inc.Chap 4-1 Basic Business Statistics (9 th Edition) Chapter 4 Basic Probability.
Passe Compose Review Gr. 8 lesson.
Basic Business Statistics, 10e © 2006 Prentice-Hall, Inc. Chap 1-1 Chapter 1 Introduction and Data Collection Basic Business Statistics 10 th Edition.
Lect12EEE 2021 Differential Equation Solutions of Transient Circuits Dr. Holbert March 3, 2008.
Essai
Introduction to Computational Journalism: Thinking Computationally JOUR479V/779V – Computational Journalism University of Maryland, College Park Nick Diakopoulos,
Français - couleurs - pays - drapeaux
The Passé Composé In the previous lesson we looked at the formation of the passé composé (perfect tense) with Avoir verbs. In this lesson we will further.
La famille ER conjugaison
Qu’est-ce que tu as dans ta trousse?
Les garanties de vie Taxes.
Efficacité des algorithmes
Quelle est la date aujourd’hui?
les instructions Bonjour la classe, sortez vos affaires
Qu’est-ce que tu as dans ta trousse?
Definition Division of labour (or specialisation) takes place when a worker specialises in producing a good or a part of a good.
Quelle est la date aujourd’hui? Aujourd’hui c’est mardi 19 septembre!
Roots of a Polynomial: Root of a polynomial is the value of the independent variable at which the polynomial intersects the horizontal axis (the function.
Quebec Provincial Elections
Quelle est la date aujourd’hui?
1-1 Introduction to ArcGIS Introductions Who are you? Any GIS background? What do you want to get out of the class?
Question formation In English, you can change a statement into a question by adding a helping verb (auxiliary): does he sing? do we sing? did they sing.
Le verbe « être » au pluriel
Manometer lower pressure higher pressure P1P1 PaPa height 750 mm Hg 130 mm higher pressure 880 mm Hg P a = h = +- lower pressure 620 mm Hg.
WRITING A PROS AND CONS ESSAY. Instructions 1. Begin your essay by introducing your topic Explaining that you are exploring the advantages and disadvantages.
Les Verbes Réfléchis What you do to yourself.
What’s the weather like?
USE OF PASSIVE PASSIVE VOICE IS USED WHEN THE FOCUS IS ON THE ACTION. IT IS NOT IMPORTANT OR NOT KNOWN, HOWEVER, WHO OR WHAT IS PERFORMING THE ACTION.
Making PowerPoint Slides Avoiding the Pitfalls of Bad Slides.
POWERPOINT PRESENTATION FOR INTRODUCTION TO THE USE OF SPSS SOFTWARE FOR STATISTICAL ANALISYS BY AMINOU Faozyath UIL/PG2018/1866 JANUARY 2019.
© by Vista Higher Learning, Inc. All rights reserved.4A.1-1 Point de départ In Leçon 1A, you saw a form of the verb aller (to go) in the expression ça.
les instructions Bonjour la classe, sortez vos affaires
1 Sensitivity Analysis Introduction to Sensitivity Analysis Introduction to Sensitivity Analysis Graphical Sensitivity Analysis Graphical Sensitivity Analysis.
Le Passé Composé (Perfect Tense)
Over Sampling methods IMBLEARN Package Realised by : Rida benbouziane.
IMPROVING PF’s M&E APPROACH AND LEARNING STRATEGY Sylvain N’CHO M&E Manager IPA-Cote d’Ivoire.
Transcription de la présentation:

MATLAB Basics With a brief review of linear algebra by Lanyi Xu modified by D.G.E. Robertson

1. Introduction to vectors and matrices MATLAB= MATrix LABoratory What is a Vector? What is a Matrix? Vector and Matrix in Matlab

What is a vector A vector is an array of elements, arranged in column, e.g., X is a n-dimensional column vector.

In physical world, a vector is normally 3-dimensional in 3-D space or 2- dimensional in a plane (2-D space), e.g.,, or

If a vector has only one dimension, it becomes a scalar, e.g.,

Vector addition Addition of two vectors is defined by Vector subtraction is defined in a similar manner. In both vector addition and subtraction, x and y must have the same dimensions.

Scalar multiplication A vector may be multiplied by a scalar, k, yielding

Vector transpose The transpose of a vector is defined, such that, if x is the column vector its transpose is the row vector

Inner product of vectors The quantity x T y is referred as the inner product or dot product of x and y and yields a scalar value (or x ∙ y). If x T y = 0 x and y are said to be orthogonal.

In addition, x T x, the squared length of the vector x, is The length or norm of vector x is denoted by

Outer product of vectors The quantity of xy T is referred as the outer product and yields the matrix

Similarly, we can form the matrix xx T as where xx T is called the scatter matrix of vector x.

Matrix operations A matrix is an m by n rectangular array of elements in m rows and n columns, and normally designated by a capital letter. The matrix A, consisting of m rows and n columns, is denoted as

Where a ij is the element in the i th row and j th column, for i=1,2, ,m and j=1,2,…,n. If m=2 and n=3, A is a 2  3 matrix

Note that vector may be thought of as a special case of matrix: a column vector may be thought of as a matrix of m rows and 1 column; a rows vector may be thought of as a matrix of 1 row and n columns; A scalar may be thought of as a matrix of 1 row and 1 column.

Matrix addition Matrix addition is defined only when the two matrices to be added are of identical dimensions, i.e., that have the same number of rows and columns. e.g.,

For m=3 and n=n:

Scalar multiplication The matrix A may be multiplied by a scalar k. Such multiplication is denoted by kA where i.e., when a scalar multiplies a matrix, it multiplies each of the elements of the matrix, e.g.,

For 3  2 matrix A,

Matrix multiplication The product of two matrices, AB, read A times B, in that order, is defined by the matrix

The product AB is defined only when A and B are comfortable, that is, the number of columns is equal to the number of rows in B. Where A is m  p and B is p  n, the product matrix [c ij ] has m rows and n columns, i.e.,

For example, if A is a 2  3 matrix and B is a 3  2 matrix, then AB yields a 2  2 matrix, i.e., In general,

For example, if and, then

and Obviously,.

Vector-matrix Product If a vector x and a matrix A are conformable, the product y=Ax is defined such that

For example, if A is as before and x is as follow,, then

Transpose of a matrix The transpose of a matrix is obtained by interchanging its rows and columns, e.g., if then Or, in general, A=[a ij ], A T =[a ji ].

Thus, an m  n matrix has an n  m transpose. For matrices A and B, of appropriate dimension, it can be shown that

Inverse of a matrix In considering the inverse of a matrix, we must restrict our discussion to square matrices. If A is a square matrix, its inverse is denoted by A -1 such that where I is an identity matrix.

An identity matrix is a square matrix with 1 located in each position of the main diagonal of the matrix and 0s elsewhere, i.e.,

It can be shown that

MATLAB basic operations MATLAB is based on matrix/vector mathematics Entering matrices Enter an explicit list of elements Load matrices from external data files Generate matrices using built-in functions Create vectors with the colon (:) operator

>> x=[ ]; >> A = [ ; ; ; ] A = >>

Generate matrices using built- in functions Functions such as zeros(), ones(), eye(), magic(), etc. >> A=zeros(3) A = >> B=ones(3,2) B = 1

>> I=eye(4)(i.e., identity matrix) I = >> A=magic(4) (i.e., magic square) A = >>

Generate Vectors with Colon (:) Operator The colon operator uses the following rules to create regularly spaced vectors: j:k is the same as [j,j+1,...,k] j:k is empty if j > k j:i:k is the same as [j,j+i,j+2i,...,k] j:i:k is empty if i > 0 and j > k or if i < 0 and j < k where i, j, and k are all scalars.

>> c=0:5 c = >> b=0:0.2:1 b = >> d=8:-1:3 d = >> e=8:2 e = Empty matrix: 1-by-0 Examples

Basic Permutation of Matrix in MATLAB sum, transpose, and diag Summation We can use sum() function. Examples, >> X=ones(1,5) X = >> sum(X) ans = 5 >>

>> A=magic(4) A = >> sum(A) ans = >>

Transpose >> A=magic(4) A = >> A' ans = >>

Expressions of MATLAB Operators Functions

Operators +Addition-Subtraction *Multiplication /Division \Left division ^Power ' Complex conjugate transpose ( )Specify evaluation order

Functions MATLAB provides a large number of standard elementary mathematical functions, including abs, sqrt, exp, and sin. pi iImaginary unit ( ) jSame as i Useful constants:

>> rho=(1+sqrt(5))/2 rho = >> a=abs(3+4i) a = 5 >>

Basic Plotting Functions plot( ) The plot function has different forms, depending on the input arguments. If y is a vector, plot(y) produces a piecewise linear graph of the elements of y versus the index of the elements of y. If you specify two vectors as arguments, plot(x,y) produces a graph of y versus x.

Example, x = 0:pi/100:2*pi; y = sin(x); plot(x,y)

Multiple Data Sets in One Graph x = 0:pi/100:2*pi; y = sin(x); y2 = sin(x-.25); y3 = sin(x-.5); plot(x,y,x,y2,x,y3)

Distance between a Line and a Point given line defined by points a and b find the perpendicular distance (d) to point c d = norm(cross((b-a),(c-a)))/norm(b-a)