% --- 1st Micro-Exercise Solution Week 4 ---
close; clear; clc;

% Define the matrices
A = [1 2 3; 4 5 6];
B = [2 0 -1; 1 1 1];

% 1. Addition and element-wise multiplication
A_plus_B = A + B
A_times_B = A .* B

% 2. Extract the second column of A
c2 = A(:,2)

% 3. Form a 2x2 matrix by stacking c2 with a vector of ones
C = [c2, ones(2,1)]

% 4. Multiply A * B' (note: need transpose for dimensions to agree)
ABt = A * B'