# Matlab

Solo disponible en BuenasTareas
• Páginas : 33 (8204 palabras )
• Descarga(s) : 0
• Publicado : 8 de diciembre de 2011

Vista previa del texto


  

 
 
Edward Neuman Department of Mathematics Southern Illinois University at Carbondale edneuman@siu.edu

One of the nice features of MATLAB is its ease of computations with vectors and matrices. In this tutorial the following topics are discussed: vectors and matrices in MATLAB, solving systems of linear equations, the inverse of a matrix,determinants, vectors in n-dimensional Euclidean space, linear transformations, real vector spaces and the matrix eigenvalue problem. Applications of linear algebra to the curve fitting, message coding and computer graphics are also included.



  
 

  


For the reader's convenience we include lists of special characters and MATLABfunctions that are used in this tutorial.

; ' .' * . ^ [] : = == \ / i, j ~ ~= & | {}

Special characters Semicolon operator Conjugated transpose Transpose Times Dot operator Power operator Emty vector operator Colon operator Assignment Equality Backslash or left division Right division Imaginary unit Logical not Logical not equal Logical and Logical or Cell

2

Function acos axis char cholcos cross det diag double eig eye fill fix fliplr flops grid hadamard hilb hold inv isempty legend length linspace logical magic max min norm null num2cell num2str ones pascal plot poly polyval rand randn rank reff rem reshape roots sin size sort

Description Inverse cosine Control axis scaling and appearance Create character array Cholesky factorization Cosine function Vector cross productDeterminant Diagonal matrices and diagonals of a matrix Convert to double precision Eigenvalues and eigenvectors Identity matrix Filled 2-D polygons Round towards zero Flip matrix in left/right direction Floating point operation count Grid lines Hadamard matrix Hilbert matrix Hold current graph Matrix inverse True for empty matrix Graph legend Length of vector Linearly spaced vector Convert numericalvalues to logical Magic square Largest component Smallest component Matrix or vector norm Null space Convert numeric array into cell array Convert number to string Ones array Pascal matrix Linear plot Convert roots to polynomial Evaluate polynomial Uniformly distributed random numbers Normally distributed random numbers Matrix rank Reduced row echelon form Remainder after division Change size Findpolynomial roots Sine function Size of matrix Sort in ascending order

3

subs sym tic title toc toeplitz tril triu vander varargin zeros

Symbolic substitution Construct symbolic bumbers and variables Start a stopwatch timer Graph title Read the stopwatch timer Tioeplitz matrix Extract lower triangular part Extract upper triangular part Vandermonde matrix Variable length input argumentlist Zeros array

  
 

The purpose of this section is to demonstrate how to create and transform vectors and matrices in MATLAB. This command creates a row vector
a = [1 2 3] a = 1 2 3

Column vectors are inputted in a similar way, however, semicolons must separate the components of a vector
b = [1;2;3] b = 1 2 3

The quote operator ' is used to create theconjugate transpose of a vector (matrix) while the dotquote operator .' creates the transpose vector (matrix). To illustrate this let us form a complex vector a + i*b' and next apply these operations to the resulting vector to obtain
(a+i*b')' ans = 1.0000 - 1.0000i 2.0000 - 2.0000i 3.0000 - 3.0000i

while

4

(a+i*b').' ans = 1.0000 + 1.0000i 2.0000 + 2.0000i 3.0000 + 3.0000i

Commandlength returns the number of components of a vector
length(a) ans = 3

The dot operator. plays a specific role in MATLAB. It is used for the componentwise application of the operator that follows the dot operator
a.*a ans = 1 4 9

The same result is obtained by applying the power operator ^ to the vector a
a.^2 ans = 1 4 9

Componentwise division of vectors a and b can be accomplished by...