%%% This script performs a set of manipulations 
%%% and linear algebra operations. 
%%% Many more functions exist.. this is a subset


clear;

%% create a matrix (this was random!)
A = [1 5 6 2 ;  8 2 4 2;4 9 7 3;  3 2 3 4]

%% create a vector
b = [ 1; 2; 3; 4]


%% some operations
%% the print statements are for reading the
%% output easier

fprintf('size of A \n')
size(A)

fprintf('size of b \n')
size(b)


fprintf('A*b \n')
A*b


fprintf('matrix A*A \n')
A*A

fprintf('element by element A*A \n')
A.*A

fprintf('element by element b*b \n')
b.*b

fprintf('transpose of A \n')
A'

fprintf('inverse(A)*b \n')
inv(A)*b

fprintf('same..\n')
A\b

fprintf('determinant of A\n')
det(A)

fprintf('condition number of A\n')
cond(A)

fprintf('eigenvalues of A\n')
eig(A)

fprintf('eigenvalues and vector of A\n')
[V,l] = eig(A)

fprintf('QR factorization of A\n')
[Q,R] = qr(A)

fprintf('max of A, by column\n')
max(A)
 
fprintf('max of A, by row\n')
max(A,[],2)


fprintf('max of A, overall\n')
max(A(:))




