{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Discussion1

Discussion1 - CS 170A Discussion 1 TA Elaine Wah Matrix...

This preview shows pages 1–2. Sign up to view the full content.

% CS 170A Discussion 1 % March 31, 2010 % TA: Elaine Wah % %------------------------------------------------------------------------- % Matrix Algebra %------------------------------------------------------------------------- % 1:5 % the row vector of values from 1 to 5 (1:5)' % the column vector of values from 1 to 5 linspace(1.3, 3.8, 6) % the row vector of length 6 w/ equispaced values of 1.3 to 3.8 3 v = [ 1 0 ] % a row vector (1x2 matrix) v' % a column vector (2x1 matrix) x = [ 1 ; 0 ] % a column vector (2x1 matrix) x.^2 % the column vector of squares of elements in x z = [ 1+2i ; 0-3i ] % a column vector of complex values z' % the corresponding complex conjugate row vector z v = [ 1; 2; 3 ] norm(v) % the vector norm of v norm(v,1) % the 1-norm (L1-norm) of v norm(v,2) % the 2-norm (L2-norm) of v norm(v,inf) % the infinity-norm of v n A = [ 1 2 ; 3 4 ] % a 2x2 matrix A * x % product of A with x x' * x % dot product of x with itself x A' % Hermitian transpose of A (complex conjugate of transpose of A) A.' % ordinary transpose of A A + A % sum of A with itself A * A % product of A with itself A^2 % product of A with itself A.^2 % matrix of squares of elements in A A * A * A % cube of A A^3 % cube of A det(A) % determinant of A trace(A) % trace of A inv(A) % inverse of A det(A) * inv(A) %

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}