Download presentation
Presentation is loading. Please wait.
Published byAngelica Lester Modified over 6 years ago
1
ECE 1304 Introduction to Electrical and Computer Engineering
Section 1.4 Operators and Functions 1
2
Commands and Operators
Description clc Clears the Command Window clear Clears all variables from memory clear var1 Clears var1 from memory exist(‘name’) Determines if a file or variable exists with the name ‘name’. quit Stops MATLAB who Lists the variables currently in memory whos Lists the variables currently in memory and indicates their size and if they are complex
3
Commands and Operators
Description + Plus; addition operator - Minus, subtraction operation * Scalar and matrix multiplication operator .* Array (point-by-point) multiplication operator ^ Scalar and matrix exponentiation operator .^ Array (point-by-point) exponentiation operator \ Left division operator / Right division operator .\ Array (point-by-point) Left division operator ./ Array (point-by-point) Right division operator : Colon; generates regularly spaced elements () Parentheses; encloses function arguments and array indices; overrides precedence
4
Commands and Operators
Description [] Brackets; encloses array elements {} Braces; encloses cell elements . Decimal point ... Ellipsis; continues a line , Comma; separates elements in an array ; Semicolon; suppresses screen printing, denotes a new row in an array % Percent sign; designates a comment and specifies formatting ' Quote sign and transpose operator .' Nonconjugated transpose operator = Assignment operator
5
Special Variables and Constants
Symbol Description ans Temporary variable containing the most recent answer. eps Accuracy of floating point calculations i, j Imaginary unit value; sqrt(-1) Inf Infinity NaN Not a number; occurs when an operation is undefined pi The number …
6
Mathematical Functions
exp(x) – Exponentiation
7
Mathematical Functions
sqrt(x) – Square Root
8
Mathematical Functions
log(x) – Natural Logarithm
9
Mathematical Functions
log10(x) – Base 10 Logarithm
10
Mathematical Functions
abs(x) – Absolute Value
11
Mathematical Functions
angle(x) – Phase Angle
12
Mathematical Functions
conj(x) – Complex Conjugate
13
Mathematical Functions
imag(x) – Imaginary Part
14
Mathematical Functions
real(x) – Real Part
15
Mathematical Functions
ceil(x) – Round toward + Inifinity
16
Mathematical Functions
fix(x) – Round toward Zero
17
Mathematical Functions
floor(x) – Round toward Negative Infinity
18
Mathematical Functions
round(x) – Round to nearest integer
19
Mathematical Functions
sign(x) – Return algebraic sign
20
Trigonometric Functions
All angles must be in radians angle_in_Radians = angle_in_Degrees*pi/180 cos(x) sec(x) sin(x) csc(x) tan(x) cot(x)
21
Inverse Trigonometric Functions
All angles are returned in radians acos(x) asec(x) asin(x) acsc(x) atan(x) acot(x) atan2(y,x) Four quadrant inverse tangent. x and y are the coordinates of a point.
22
Trigonometric Functions
All angles must be in degrees angle_in_Degrees = angle_in_Radians*180/pi cosd(x) secd(x) sind(x) cscd(x) tand(x) cotd(x)
23
Inverse Trigonometric Functions
All angles are returned in degrees acosd(x) asecd(x) asind(x) acscd(x) atand(x) acotd(x) atan2d(y,x) Four quadrant inverse tangent. x and y are the coordinates of a point.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.