Matlab- Matrix basics

Where A,v is matrix,

A=A' (transpose)
 v = 1:.5:3 (A vector filled in a specified range)
 v = []  (empty vector)
 v = ones(a:a)
 v = eyes(a:a)
 v = rand(a:a)
 v = zeros(a:a)
 v = (x,y) (access element at x row and y column)
 v = m(x,:) (access all the elements in the row)
 v = m(:,x) (access all the elements in the column)
 v = m(1,a:c) ( access all the elements in the first row from a to c column)
 v = m(1,a:end) ( access all the elements in the first row from a to end column)
 v = size(m) (dimension of matrix)
 v = size(m,1) ( number of rows)
 v = size(m,2) ( number of columns)
 who ( list of variables)
 whos ( list of data about variables)
 v = a*^2 ( element wise squaring)
 v = a*/2 ( element wise dividing)
 v = log([a b c; d e f]) ( element wise log)
 v = sum(a)
 v = mean(a)
 v = var(a)
 v = std(a)
 v = max(A(n,:)) ( max value in the nth row)
 v = min(A(:,n)) ( min value in the nth column)
 v = max(max(a)) ( max value of a matrix)
 v = inv(a) ( inverse of matrix)
 v = eig(a) ( eigen value vector)
 v = a(:) (concatenate all the elements in matrix of single column)
 v = diag(a) ( create diagonal matrix with elements of a)
 v = vertcat(a,b) ( concatenate matrixes vertically)
 v = horzcat(a,b) ( concatenate matrixes horizontally)
 v = repmat(a,2,2) ( replicate 'a' matrix, 2 times vertically, 2 times horizantaly
 v = blkdiag(a,b,c) ( combine all the matrixes in diagonal direction)
 [x,y] = meshgrid(-a:0.5:d, a:0.5:d) ( meshgrid)
 surf(x,y,z) ( surface plot)

Reference: http://in.mathworks.com/
Advertisements

About YANAMALA VIJAY RAJ

Mtech in Clinical Eng Jointly offered by Indian institute of technology Madras& Christian medical college Vellore& Sree chitra tirunal institute for medical sciences and technology Trivandrum.
This entry was posted in MATLAB. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s