EENG 2101 Matlab for Engineers - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

EENG 2101 Matlab for Engineers

Description:

Trignometric functions: sin(x), cos(x), tan(x) Inverse trignometric functions: ... ceil: round upward to nearest integer. floor: round down to nearest integer ... – PowerPoint PPT presentation

Number of Views:139
Avg rating:3.0/5.0
Slides: 10
Provided by: david652
Category:
Tags: eeng | ceil | engineers | matlab

less

Transcript and Presenter's Notes

Title: EENG 2101 Matlab for Engineers


1
EENG 2101Matlab for Engineers
  • The Matlab math functions you will need most as
    an engineer
  • Addition Subtraction -
  • Multiplication x Division /
  • Exponentiation (raising to a power) xy
  • Exponentiation of the Naperian base e exp(x)
  • Trignometric functions sin(x), cos(x), tan(x)
  • Inverse trignometric functions asin(z), acos(z),
    atan(z), atan2(y,x)
  • Conversion of complex numbers in rectangular form
    (x j y) into polar form (z ?) zabs(xjy)
    thetaangle(xjy)
  • Conversion of complex numbers in polar form to
    rectangular form
  • xzcos(theta) yzsin(theta) wxjy

2
EENG 2101Matlab for Engineers
  • The Matlab math functions you will need most as
    an engineer
  • Most mathematical functions operate identically
    on vectors (one-dimensional arrays of numbers) as
    they do on scalars (single numbers)
  • Matrix addition or subtraction can be performed
    only when the matrices have identical sizes
    (number of rows and columns)
  • Multiplication of matrices must proceed according
    to the rules of matrix multiplication.
  • Multiplication of two matrices on an
    element-by-element basis can be accomplished by
    the . operator

3
EENG 2101Matlab for Engineers
Matrix multiplication example
gtgt A3 4 5B1 -1 2'CABDBA gtgt C C
9 gtgt D D 3 4 5 -3 -4
-5 6 8 10 gtgt
4
EENG 2101Matlab for Engineers
  • The Matlab math functions you will need most as
    an engineer
  • Natural logarithm ylog(x)
  • Base 10 logarithm ylog10(x)
  • Linearly-spaced points xlinspace(0,10)
    Creates 100 points 0-10
  • xlinspace(0,10,21) Creates a vector of 21
    points between 0 and 10
  • Logarithmically-spaced points
    xlogspace(1,6,61)
  • Creates a vector of 61 logarithmically-spaced
    points between 101 and 106 (Particularly useful
    for frequency-response plots)

5
EENG 2101Matlab for Engineers
  • The Matlab math functions you will need most as
    an engineer
  • Statistical functions ysum(x)
    ymax(x) a,bmax(x)
  • ymin(x) a,bmin(x) ymean(x) ystdev(x)
  • ymedian(x)
  • Random-number generation rand
    (uniformly-distributed)
  • rand by itself returns one random number between
    0 and 1.
  • rand(n) returns an n x n matrix of random numbers
    between 0 and 1.
  • rand(m,n) returns an m x n matrix of random
    numbers between 0 and 1.
  • To create a row of 100 uniformly-distributed
    random numbers between -5 and 5
  • Z10rand(1,100)-5

6
EENG 2101Matlab for Engineers
  • The Matlab math functions you will need most as
    an engineer

Random-number generation randn
(normally-distributed with zero mean and unit
variance) randn by itself returns one random
number. randn(n) returns an n x n matrix of
random numbers. randn(m,n) returns an m x n
matrix of random numbers. To create a 50-element
column vector (50 rows, 1 column) of
normally-distributed random variables with a mean
of 10 and standard deviation of
6 Qrandn(50,1)610
7
EENG 2101Matlab for Engineers
  • The Matlab math functions you will need most as
    an engineer

Working with matrices A(m,n) gives the element
at row m and column n of matrix A. A(,n) gives
column n of matrix A. A(m,) gives row m of
matrix A. A(mn, pq) gives the elements located
between rows m and n and columns p and
q. AAB appends matrix B to A and re-assigns
the result to A (Matrices A and B must have
the same number of columns) AA B appends
matrix B to A and re-assigns the result to A
(Matrices A and B must have the same number of
rows)
8
EENG 2101Matlab for Engineers
  • The Matlab math functions you will need most as
    an engineer

Working with matrices A(m,n) gives the element
at row m and column n of matrix A. A(,n) gives
column n of matrix A. A(m,) gives row m of
matrix A. A(mn, pq) gives the elements located
between rows m and n and columns p and
q. AAB appends matrix B to A and re-assigns
the result to A (Matrices A and B must have
the same number of columns) AA B appends
matrix B to A and re-assigns the result to A
(Matrices A and B must have the same number of
rows)
9
EENG 2101Matlab for Engineers
  • The Matlab math functions you will need most as
    an engineer

rem remainder in division round round to
nearest integer ceil round upward to nearest
integer floor round down to nearest
integer abs absolute value (or modulus of a
complex number) cosh hyperbolic cosine
function sinh hyperbolic sine function tanh hype
rbolic tangent function size gives the
dimensions of a Matlab variable sqrt square root
(gives imaginary result if the argument is
negative)
Write a Comment
User Comments (0)
About PowerShow.com