Matlab vectors: a = [0 2] % row vector a = [0 2]' % transpose, col vector a = [0; 2] % also col vector (; = stacking) matrices: A = [1 2; 3 4] x = A \ a % solving linear equation A * x x = -20:0.1:10 % range put ';' at the end for no output y = sim(x) plot(x, y) title("plot") xlabel("x") ylabel("y") A A*A A*A' A'*A norm(A) % L² norm B = [1 1; 1 1] norm(B) % should be 2 eig(A) [U, D, V] = svd(A) U*D*V' A = [1 2 3; 4 5 6] C = pinv(A) % penrose inverse A*C C*A rank(A) rank(B) trace(A) trace(A*A') norm(A, 'Fro') sqrt(trace(A*A')) det(A) %%% to solve the problem in our first test lam = -10:0.1:10 line = repeat([0;2], size(lam)) + [1;1]*lam d = norm([0;2] + [1;1]*lam, 2 "cols") plot(lam, d) d = arrayfn(@(n) norm(line(i,n), 1:size(line,2)) plot(lam, d)