1 / 14

LAB 3 : Matrix Operation

LAB 3 : Matrix Operation. Computing Matrix Functions. Norm :(measurement) For vectors... norm(V,P) = sum(abs(V).^P)^(1/P). norm(V) = norm(V,2). norm(V,inf) = max(abs(V)). Ex: x=[1 2 3]; , norm(x) ans = 3.7417. Eigenvalues and Eigenvectors.

derex
Télécharger la présentation

LAB 3 : Matrix Operation

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. LAB 3 : Matrix Operation NCU ME DCS-Lab

  2. Computing Matrix Functions • Norm:(measurement) • For vectors... • norm(V,P) = sum(abs(V).^P)^(1/P). • norm(V) = norm(V,2). • norm(V,inf) = max(abs(V)). • Ex: x=[1 2 3]; , norm(x) • ans = • 3.7417 NCU ME DCS-Lab

  3. Eigenvalues and Eigenvectors • 一個 n × n 方陣A, 存在λ, 滿足Ax= λx • 稱λ為 eigen value, • x 為eigen vector. • Ex: A=[1 2 3; 4 5 6; 7 8 9]; • eig(A) 求 eigen value • ans = 16.1168 • -1.1168 • 0.0000 NCU ME DCS-Lab

  4. [X,D]=eig(A) • (X:eigen vector;D:eigen value) • x = 0.2320 0.7858 0.4082 • 0.5253 0.0868 -0.8165 • 0.8187 -0.6123 0.4082 • d = 16.1168 0 0 • 0 -1.1168 0 • 0 0 0.0000 NCU ME DCS-Lab

  5. Characteristic equation • p = poly(A) • p = 1.0000 -15.0000 -18.0000 0.0000 • characteristic equation : x3-15x2-18x+0=0 • 其根為:r = roots(p) • r = 16.1168 • -1.1168 • 0.0000 • p2 = poly(r) • p2 = 1.0000 -15.0000 -18.0000 0.0000 NCU ME DCS-Lab

  6. Product of polynomials • a(s) = s2+2s+3 • b(s) = 4s2+5s+6 • a = [1 2 3]; • b = [4 5 6]; • c = conv(a,b) • c = 4 13 28 27 18 • c(s) = 4s4+13s3+28s2+27s+18 NCU ME DCS-Lab

  7. Division of polynomials • [q, r] = deconv(c, a) • q = 4 5 6 • r = 0 0 0 0 0 • [q2, r2] = deconv(c, b) • q2 = 1 2 3 • r2 = 0 0 0 0 0 NCU ME DCS-Lab

  8. Polynomial evaluation • evaluate polynomial a(s) = s2+2s+3 at s = 5 • polyval(a,5) • ans = 38 • 若 ploynomial 為矩陣運算: • =>A2+2A+3I • polyvalm(a,A) • ans = 35 40 48 • 74 94 108 • 116 142 171 NCU ME DCS-Lab

  9. Absolute value and phase angle • abs(A) = sqrt(real(A).^2 + image(A).^2) • angle(A) returns phase angles (π ~ - π) • A = [2+2*i 1+3*i; 4+5*i 6-i] • abs(A) (complex returns magnitude) • ans = 2.8284 3.1623 • 6.4031 6.0828 • angle(A) • ans = 0.7854 1.2490 • 0.8961 -0.1651 NCU ME DCS-Lab

  10. Magnitude and phase angle • Complex number: • z = x + y*i = r*eiθ • r = abs (z) • theta= angle(z) • => z = r*exp(i*theta) NCU ME DCS-Lab

  11. Matrix function • expm:矩陣的指數函式運算 • expm(A)=I+A+A2/2!+A3/3!+... • logm:矩陣的對數函式運算 • sqrtm:矩陣的開方根運算 • Note that a function is interpreted as a matrix function if an “m” is appended to the function name. NCU ME DCS-Lab

  12. 實用矩陣函式 • zeros:zeros(m,n) => m×n matrix of zeros • zeros(A) => size(A) matrix of zeros • ones:ones(m,n) => m×n matrix of ones • rand:平均分布的亂數矩陣 • randn:高斯分布的亂數矩陣 • eye:Identity matrix • diag:Diagonal matrix NCU ME DCS-Lab

  13. 矩陣操作函式 • rot90:矩陣旋轉90度 • fliplr:矩陣左右反 • flipup:矩陣上反置 • tril:下三角矩陣 • triu:上三角矩陣 • reshape:改變矩陣的維數 NCU ME DCS-Lab

  14. 常用資料分析函式 • max(A):矩陣A中每行向量的最大值 • min(A):矩陣A中每行向量的最小值 • mean(A):矩陣A中每行向量的平均值 • median(A):矩陣A中每行向量的中間值 • std(A):矩陣A中每行向量的標準差 • sort(A):矩陣A中每行由小到大排序 • sum(A):矩陣A中每行向量的總和 • prod(A):矩陣A中每行元素的連乘積 NCU ME DCS-Lab

More Related