%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Module I: Basic Vector and Matrix Operations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% NOTE: to see results in the Command Window, 
% simply delete the ";" at the end of a given command.

x=[1;2;3];
y=[4 5 6];
xr=x';
yc=y';

X=[1 2; 3 4];
M=[1 2;3 4;5 6];

X1=X';
M1=M';

A=[ones(3,1) zeros(3,1) [1;2;3]];
B=[3*ones(3,1) 2*ones(3,1) ones(3,1)];

C=A+B;
C1=A-B;

% Identity matrix and vector of ones
n=10;
I=eye(n);
i=ones(n,1);

% Dot - operator
A=[ones(4,1) 2*ones(4,1) 8*ones(4,1)];
B=repmat([1;2;4;8],1,3);

C=A./B;
D=A.*B;

E=A.^2; %squares all elements of A
F=sqrt(A);% dot is optional for sqrt

% practice
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
A=[2 3 1;0 -1 2];
B=[0 1 -1;4 -1 2];
C=[1 2;3 -1];
D=[2 1;1 1];
E=[1;-1];

M1=A+B;
M2=C*A;
%etc..


