Beruflich Dokumente
Kultur Dokumente
LESSON OUTCOMES
At the end of this topic, the students will be
able:
3
1.1 Assignment
second element of v
>> v(2)
ans?
element of v can be changed
>> v(4) = 100
ans?
1.2.3 Creating Matrices
2 4 10
16 3 7
Matrix also can create from row or column vectors.
(if matrix A and row vector r have same number of
columns)
>> A=[2 4 10;16 3 7];
>> d=[1,3,5];
>> e=[4;5];
>> x=[A;d] ans??
>> y=[A,e] ans??
Exercise:
>> A=[6,3;2,1]
>> B=[4,8;2,7]
>> b=2
Symbol Operation
MN M*N
M-1 inv(M)
MT M'
det(M) det(M)
X=M/N solution to X*N = M {X = M*inverse(N)}
X=M\N solution to M*X = N {X = inverse(M)* N}
Exercise:
>> M=[6,3;2,1]
>> N=[4,8;2,7]
1.2.5 Array Addressing
ROW number is always listed first!!
>>A=[1 3 4 6 8; 12 23 1 3 5; 22 3 4 6 7]
A(2,3) = element in row 2,column 3 in matrix A
4 10 13
X= 3 7 18
4 9 25
2 4 10 13 12 15 17
16 3 7 18
8 4 9 25 ans =
3 12 15 17
3 7 18
4 9 25
Command??
ans =
>> X(2,3)
X=
10
7
2 4 10 13
9
16 3 7 18
15
8 4 9 25 ans = ??
3 12 15 13
Exercise
The terminal velocity reached by a sky diver depends on many factors, including
their weight, their body position as they fall, and the density of the air through
which they fall. The terminal velocity is given by
where
2mg m is the sky diver's mass
V g is Earth's gravitational constant
rACd r is the atmospheric density
A is the sky diver's effective area
Cd is the sky diver's coefficient of drag
Compute the terminal velocity of the sky diver for each of the following values of
m:
m = 40kg
m = 80kg
m = 120kg
length(A)
size(A)
reshape(A)
diag(v)
diag(A)