Professional Documents
Culture Documents
TP01 - en
TP01 - en
TP01
Objective: This TP relates to vector and matric by using MATLAB. It is an initial work to learn
how to use help for learning new functions. The built-in functions are written in bold and italic.
Note: Scripts must save in extension “.m”. To separate each exercise, you should use comment.
2.71
b. 𝑏𝑉𝑒𝑐 = [ 8 ]
28
182
3 ⋯ 3
a. 𝑎𝑀𝑎𝑡 = [ ⋮ ⋱ ⋮ ] (a matric 9x9 for all 3, use ones or zeros)
3 ⋯ 3
1 ⋯ 0 0
0 0⋱ ⋱
b. 𝑏𝑀𝑎𝑡 = ⋮ 50 0 ⋮ (a matric 9x9 for all 0 but with these values
0⋱ ⋱ 0
[0 ⋯ 0 1]
[1 2 3 4 5 4 3 2 1] in diagonal, use zeros, diag)
1 11 ⋯ 91
2 12 ⋱ 92
c. 𝑐𝑀𝑎𝑡 = [ ]
⋮ ⋮ ⋱ ⋮
10 20 ⋯ 100
𝑁𝑎𝑁 𝑁𝑎𝑁 𝑁𝑎𝑁 𝑁𝑎𝑁
d. 𝑑𝑀𝑎𝑡 = [𝑁𝑎𝑁 𝑁𝑎𝑁 𝑁𝑎𝑁 𝑁𝑎𝑁] (a matric 3x4, use NaN)
𝑁𝑎𝑁 𝑁𝑎𝑁 𝑁𝑎𝑁 𝑁𝑎𝑁
13 −1 5
e. 𝑒𝑀𝑎𝑡 = [ ]
−22 10 −87
f. Initialize 𝑓𝑀𝑎𝑡, a matric 6x4 integers with random values between -5 and 5 (use
rand and floor or ceil)
4. Scalar equations: By using the variables created in exercise 1, calculate 𝑥, 𝑦, et 𝑧 :
1
a. 𝑥 = 1+𝑒 (−(𝑎−15)/6)
21 𝜋
b. 𝑦 = (√𝑎 + √𝑏) (use sqrt)
𝑎𝜋
c. 𝑧 = log (𝑅(𝑐) sin ( 3 )) /𝑐𝑐̅ where 𝑅 real part of complex number, 𝑐̅ a conjugate of
𝑐 (use real, conj, log)
5. Vector equations: By using the variables created in exercise 2, solve these equations
1 2 2
a. 𝑥𝑉𝑒𝑐 = √2𝜋2.52 𝑒 −𝑐𝑉𝑒𝑐 /(2×2.5 )
b. 𝑦𝑉𝑒𝑐 = √(𝑎𝑉𝑒𝑐 𝑇 )2 + 𝑏𝑉𝑒𝑐 2 (𝑎𝑉𝑒𝑐 𝑇 signify 𝑎𝑉𝑒𝑐 transpose)
c. 𝑧𝑉𝑒𝑐 = log10 (1/𝑑𝑉𝑒𝑐) (use log10)
6. Matric equation: By using the variables created in exercise 2&3, solve these equations
a. 𝑥𝑀𝑎𝑡 = (𝑎𝑉𝑒𝑐 ⋅ 𝑏𝑉𝑒𝑐) ⋅ 𝑎𝑀𝑎𝑡 2
b. 𝑦𝑀𝑎𝑡 = 𝑏𝑉𝑒𝑐 ⋅ 𝑎𝑉𝑒𝑐
c. 𝑧𝑀𝑎𝑡 = |𝑐𝑀𝑎𝑡|(𝑎𝑀𝑎𝑡 ⋅ 𝑏𝑀𝑎𝑡)𝑇 où |𝑐𝑀𝑎𝑡| is determining of 𝑐𝑀𝑎𝑡 (use det)