Escolar Documentos
Profissional Documentos
Cultura Documentos
Chapter 2
Data Types, Operators, and Expressions
2.1 Numerical Data Types
2.2 Character Data Type
2.3 Logical Data Type
2.4 Arrays
2.5 Sums, Products, Minima, and Maxima
2.6 Arithmetic Operators
2.7 Relational and Logical Operators
2.8 String Manipulations
2.9 Expressions
2.10 Example: Function Approximations
2.11 Example: Series Solution of a Laplace Equation
2.12 Example: Deflection of Beams
2.13 Example: Vibrations of Supported Machines
2.14 Additional Exercise Problems
2
0 1 0 0 0 0 0 0 0 0 1111 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
4
Concepts
Logical values Functions
Relational operators
Logical operators logical
Conversion between logical true
values and numbers false
7
2.4 Arrays
Concepts
Zero-dimensional arrays: scalars
One-dimensional arrays: row vectors and column vectors
Two-dimensional arrays: matrices
Three-dimensional arrays
First dimension: row dimension
Second dimension: column dimension
Third dimension: page dimension
Functions
ones
linspace
8
Functions
zeros
size
length
end
Concepts
Subscript indexing & linear indexing
Size and length of an array
9
Concepts Functions
Colon: the entire column/row reshape
[]: empty data
10
Functions
horzcat
vertcat
fliplr
flipud
11
Functions
sum
cumsum
prod
cumprod
diff
min
max
12
Functions
find
isequal
16
Functions
echo
disp
num2str
sprintf
deblank
17
Functions
strcmp
break
18
2.9 Expressions
a b c abc
= = = = 2R
sin α sin β sin γ 2A
abc
R=
(a + b + c)(a − b + c)(b − c + a)(c − a + b)
Functions
sind
asind
19
a 2 = b 2 + c 2 − 2bc cos α
x3 x5 x7
Taylor series: sin x = x − + − + ...
3! 5! 7!
21
Using For-Loop
22
Vector Expressions
23
Matrix Expressions
24
Multiple Curves
25
mx + cx + kx = F sin ω f t
Steady-State Response
x(t) = xm sin(ω f t − ϕ )
F k
xm =
( ) ( )
2
+ 2 ( c cc ) ω f ω
2 2
1− ω f ω
ϕ = tan −1
(
2 ( c cc ) ω f ω )
( )
2
1− ω f ω
30