Vector spaces in MATLAB — exercises to program your own Gram-Schmidt, a projection and the phone bill line (and the basis I failed in lab assignment 3)
In lab assignment 3 of AG (Linear Algebra and Geometry) I got a 5 again, and one of the questions I failed asked for a basis of a subspace given by two implicit equations, with format rat and keeping the fractions. The command that solves it fits in one line, null(A, 'r'), and in this article you’ll use it inside your own functions, together with a Gram-Schmidt you write yourself, with its loops and its tolerances.
Table of Contents
How to use this article
The algebra is taken as known: what a basis is, a subspace given by implicit equations, the dot product or a projection are in Vector spaces and Euclidean space. Here you program: for and while loops, if conditions, functions that return several things and, above all, comparing decimal numbers without falling into == 0. The MATLAB pieces are in the theory of this block, MATLAB intensive 2: vector spaces and Euclidean space.
The example running through the article is the phone bill month by month: six months of bills, a line that sums them up and the usual question, when will you go over €30. That line is a projection, and you’ll compute it with your own Gram-Schmidt.
- Level 1 (reproduce): Command Window commands on bases, implicit equations and angles, with what comes out.
- Level 2 (write the function): your
my_gs(Gram-Schmidt) and yourproject, checked with dot products. - Level 3 (full lab assignment): the bill line step by step, with the questions the assignment quiz would ask.
- The solutions are folded. After them come “What is wrong here?” and a 10-question code-reading quiz.
All the code was run once with the interpreter of the website’s MATLAB environment, which gives the same outputs as MATLAB R2025a.
Level 1: bases, implicit equations and angles
Exercise 1. a) The subspace has the implicit equations and . Write the coefficient matrix and the command that gives a basis of with the parameters set to 1 and 0. Write it again with format rat and check with a matrix product that the vectors satisfy both equations. b) Compute the cosine and the angle in degrees between and . c) Predict what dot([0.1 0.2 0.3], [3 0 -1]) == 0 returns and then check it.
Expected result: , with basis ; the cosine is 0.5963 and the angle, 53.3957°; the comparison with == 0 gives 0 (false), even though the two vectors are orthogonal.
The number of basis vectors is the number of unknowns minus the rank of the matrix. And in c), do the sum by hand: … but the computer doesn’t store 0.1 or 0.3 exactly.
Level 2: writing your own Gram-Schmidt and projection
Exercise 2. a) Write a function Q = my_gs(V) that takes some vectors in the columns of V and returns in the columns of Q an orthonormal basis of the subspace they span. If a column depends on the previous ones, the function must skip it and say so with fprintf, without stopping. b) Write [p, c] = project(v, U), which returns the orthogonal projection p of v onto the subspace spanned by the columns of U and the coefficients c of p in those columns. c) Test my_gs with the columns of and check that Q'*Q is the identity; test it also with the columns of .
Expected result: with the first matrix you get three orthonormal columns and Q'*Q is the identity (with the odd 0.0000); with the second, the function warns that column 2 depends on the previous ones and returns only two columns.
The orthonormal basis starts empty, Q = zeros(n, 0), and grows with Q = [Q, w/norm(w)]. From each vector you remove its projection onto each column already in Q. A column “depends” when what is left has an almost-zero norm, not exactly zero.
Level 3: a full lab assignment
As in the lab assignment guides on the campus: each part asks for a command or a short answer, and at the end there are questions like the quiz ones. Use my_gs and project.
Exercise 3. The phone bill line. The bills for the last six months were €12, 15, 14, 18, 20 and 21. We want the line that sums them up best.
- a) Write the vector
gof bills (as a column), the column of onesoneand the column of monthsmonth, and the matrixU = [one month]. With two ranks, justify thatgis not in the subspace spanned by the columns ofU(that is, that no line goes through the six points). - b) Compute with
projectthe projectionpofgand its coefficients. What is the line? - c) Check that the error
r = g - pis orthogonal to both columns ofUwith a single command and a tolerance. - d) What does the line predict for month 7? Write a
whileloop that moves forward month by month from month 6 until the line goes over €30 and say in which month it happens. - e) Quiz questions: (1) True or false:
gis a linear combination of the columns ofU. (2) Fill in: the projectionpis the vector of the subspace ___ tog. (3) What doesU \ greturn in this system of six equations and two unknowns?
Expected result: ranks 2 and 3; the line is ; U'*r comes out around ; the prediction for month 7 is €23.07 and the line goes over €30 in month 11.
The rank of [U g] is 3 if g adds a new direction. In c), U'*r gives both dot products at once (column of ones times r and column of months times r).
What is wrong here?
Snippet 1: the Gram-Schmidt that subtracts the wrong thing
V = [1 1; 1 0; 0 1]; q1 = V(:,1) / norm(V(:,1)); w = V(:,2) - dot(V(:,2), V(:,1)) * V(:,1); q2 = w / norm(w); dot(q1, q2)
Output:
ans = -0.5000
q1 and q2 should be orthogonal and their dot product is not zero. It subtracts the projection onto the original vector V(:,1), which doesn’t have norm 1: the formula only works with a unit . Since V(:,1) measures , it subtracts twice as much as it should.
Using the original vector instead of the normalised one. Either divide by the squared norm, , or use q1, which is already a unit vector.
w = V(:,2) - dot(V(:,2), q1) * q1; q2 = w / norm(w); dot(q1, q2)
Output:
ans = 1.1102e-16
Now it comes out as : zero, apart from the usual rounding. That is why the orthogonality check is never done with == 0, as you’ll see in snippet 2.
Snippet 2: two orthogonal vectors that “aren’t”
w = [0.1 0.2 0.3]; z = [3 0 -1];
if dot(w, z) == 0
disp('They are orthogonal')
else
disp('They are not orthogonal')
end
Output:
They are not orthogonal
By hand, . On the computer, 0.1 and 0.3 aren’t stored exactly, and the dot product comes out as : almost zero, but not zero.
dot(w, z)
Output:
ans = 5.5511e-17
Comparing with == 0 a number that comes out of decimal arithmetic. Compare with a tolerance: abs(dot(w, z)) < 1e-10. With small integer vectors it doesn’t happen, which is why the bug shows up precisely with real data.
if abs(dot(w, z)) < 1e-10
disp('They are orthogonal')
end
Output:
They are orthogonal
Snippet 3: the while that never ends
month = 6; cost = 21; while cost <= 30 cost = 10.27 + 1.83 * month; end
Output:
Execution stopped: too many steps (is there a loop that never ends?).
In MATLAB this keeps thinking forever (you stop it with Ctrl + C); the website’s environment cuts it off and tells you. The condition depends on cost, cost depends on month… and month never changes inside the loop: every iteration computes the same number.
Before writing a while, ask yourself which variable in the condition changes in each iteration. If none does, the loop can’t end. Here month = month + 1; is missing.
Solutions
Exercise 1
Before you open the solution, the plan. In a) you are not asked to solve a system by hand, but to translate it: the vectors of are exactly the ones that satisfy , so its basis is the basis of the null space of the coefficient matrix. That is why the command is null, and not solving for the unknowns. What decides which basis comes out is the ‘r’: MATLAB row-reduces the matrix and gives one vector per free parameter, with that parameter set to 1 and the others to 0. This is the row reduction it does inside:
A = [1 2 -1 1; 3 -1 2 -2]; format rat R = rref(A)
Output:
R =
1 0 3/7 -3/7
0 1 -5/7 5/7
Read it row by row: and . The columns of and have no pivot: they are the parameters. With you get , , the first vector of the basis; with , the second one.
Show the solution to exercise 1
a)
A = [1 2 -1 1; 3 -1 2 -2]; B = null(A, 'r') format rat B format short A * B
Output:
B =
-0.4286 0.4286
0.7143 -0.7143
1.0000 0
0 1.0000
B =
-3/7 3/7
5/7 -5/7
1 0
0 1
ans =
1.0e-16 *
-2.2204 2.2204
0 0
Rank 2 and four unknowns: the basis has vectors, with and as parameters (hence the 1 and 0 in the last two rows). With format rat you read and . And A*B gives the zero matrix: each column of B satisfies both equations. Notice it comes out here with a 1.0e-16 factor: rounding leftovers, the same story as snippet 2.
b)
u = [1 2 2]; v = [2 0 1]; co = dot(u, v) / (norm(u) * norm(v)) ang = acosd(co)
Output:
co =
0.5963
ang =
53.3957
By hand: , , , and . acosd gives the angle in degrees directly; with acos it would come out in radians.
c)
dot([0.1 0.2 0.3], [3 0 -1]) == 0
Output:
ans = logical 0
It gives 0 (false). It is snippet 2 in miniature.
Why it is done this way: the name co and not cosd, because cosd is a MATLAB function (the cosine in degrees) and naming a variable like that hides it until you clear it. And null(A, 'r'), not null(A): without the 'r' you get an orthonormal basis with decimals, which is valid but not the one a quiz with fractions asks for.
Exercise 2
The plan for my_gs, before writing a single line. There are three decisions:
- Where what you have built is kept. Q starts with zero columns and grows, so “the q’s already built” are always the columns of Q, and the inner loop runs over 1:size(Q, 2), which does no turns at all the first time.
- What is done to each column. Remove its part along each q already built: only with respect to the columns of Q, which are already orthonormal, not the columns of V.
- When a column is skipped. When what is left is almost zero. The obvious path, norm(w) == 0, fails for the same reason as snippet 2.
Show the solution to exercise 2
function Q = my_gs(V)
% Gram-Schmidt: orthonormal basis (in columns) of the span of the columns of V.
Q = zeros(size(V, 1), 0); % starts with no columns
for j = 1:size(V, 2)
w = V(:, j);
for k = 1:size(Q, 2)
w = w - dot(w, Q(:, k)) * Q(:, k); % remove its part along each q already built
end
if norm(w) < 1e-10 % almost zero: it depended on the previous ones
fprintf('Column %d depends on the previous ones: skipping it.\n', j);
continue
end
Q = [Q, w / norm(w)]; % normalise it and add it
end
end
function [p, c] = project(v, U)
% Orthogonal projection of v onto the span of the columns of U,
% and its coefficients in those columns.
Q = my_gs(U);
p = Q * (Q' * v); % sum of <v, q_k> q_k
c = U \ p; % p is in the subspace: exact solution
end
Q = my_gs([1 1 0; 1 0 1; 0 1 1]) Q' * Q Q2 = my_gs([1 2 0; 2 4 1; 0 0 1])
Output:
Q =
0.7071 0.4082 -0.5774
0.7071 -0.4082 0.5774
0 0.8165 0.5774
ans =
1.0000 0.0000 0.0000
0.0000 1.0000 0.0000
0.0000 0.0000 1.0000
Column 2 depends on the previous ones: skipping it.
Q2 =
0.4472 -0.3651
0.8944 0.1826
0 0.9129
Q'*Q is the matrix of all the dot products between the columns of Q: ones on the diagonal (each column has length 1) and zeros elsewhere (they are orthogonal). The 0.0000 are, again, leftovers of . With the second matrix, the column is twice the first: after removing its projection the zero vector is left, the function detects it, says so and carries on.
The picture shows what one pass of the inner loop does: each vector loses its shadow on every direction already in Q.
Why it is done this way:
w = w - dot(w, Q(:,k)) * Q(:,k)uses thewthat has already been cleaned up (modified Gram-Schmidt), not the original vector. On paper it makes no difference; on the computer it builds up less error.continueinstead oferror: a dependent vector isn’t the user’s fault, it just adds nothing. The function goes on with the others.- In
project,Q * (Q' * v)does in one go:Q'*vare the dot products andQ*uses them as coefficients. c = U \ pworks becausepis in the subspace: that system is consistent and\gives the exact solution.
How I would mark it (rough breakdown, my own):
| What is assessed | Points |
|---|---|
Double loop: one pass per column and another per q already built | 1.5 |
Normalise and add columns to Q | 0.5 |
Dependent columns with a tolerance, a message and continue | 1 |
project with two outputs | 1 |
Check with Q'*Q | 1 |
The second matrix, turn by turn, since it is the one with the catch:
| j | w at the start | I remove | w at the end | Why |
|---|---|---|---|---|
| 1 | (1, 2, 0) | nothing | (1, 2, 0) | Q is empty; it is normalised and q1 = (0.4472, 0.8944, 0) |
| 2 | (2, 4, 0) | 4.4721 · q1 | (0, 0, 0) | it is twice the first one: it was all shadow on q1, so it warns and continues |
| 3 | (0, 1, 1) | 0.8944 · q1 | (-0.4, 0.2, 1) | its length is , far from zero: it is normalised |
Why orthonormalise before projecting? Because the obvious path, projecting onto each column of U separately and adding up, only works if those columns are orthogonal. The ones in exercise 3 are not:
g = [12; 15; 14; 18; 20; 21]; one = ones(6, 1); month = (1:6)'; dot(one, month) p_wrong = dot(g, one)/dot(one, one) * one + dot(g, month)/dot(month, month) * month; U = [one month]; p_right = U * (U \ g); [p_wrong p_right]
Output:
ans =
21
ans =
20.8645 12.0952
25.0623 13.9238
29.2601 15.7524
33.4579 17.5810
37.6557 19.4095
41.8535 21.2381
The dot product of the two columns is 21, not 0, and the left column reaches almost €42 in month 6, when the bill was €21: the two shadows overlap, because each one already carries a piece of the other. Gram-Schmidt removes that overlap before adding up.
Exercise 3
The plan: each part is a question about bills that has to be translated into algebra (the “best line” is not new statistics, it is the projection from exercise 2):
| What is asked | Translated | Tool |
|---|---|---|
| Is there a line through the six points? | Is g in the subspace of one and month? | rank(U) against rank([U g]) |
| Which line sums them up best? | Which vector of the subspace is closest to g? | project |
| Is it really the best? | Is the error perpendicular to the subspace? | U’*r with a tolerance |
| When will I go over €30? | First month with ? | a while that moves m forward |
Show the solution to exercise 3
a)
g = [12; 15; 14; 18; 20; 21]; one = ones(6, 1); month = (1:6)'; U = [one month]; rank(U), rank([U g])
Output:
ans =
2
ans =
3
The rank goes up from 2 to 3: g is not a linear combination of the columns of U. In plain words: no line goes through the six points.
b)
[p, c] = project(g, U)
Output:
p =
12.0952
13.9238
15.7524
17.5810
19.4095
21.2381
c =
10.2667
1.8286
The line is : about €10 fixed and almost €2 more each month. p are the values of the line in months 1 to 6.
c)
r = g - p; U' * r all(abs(U' * r) < 1e-10)
Output:
ans =
1.0e-14 *
-2.1316
2.6645
ans =
logical
1
Both dot products are around and the check with a tolerance gives 1. The error is perpendicular to the subspace: that is what makes p the orthogonal projection, and that is why this line is the least squares line.
The picture shows the six months, the line and, for each month, the piece of error r that the projection makes as small as possible.
d)
c(1) + c(2)*7 m = 6; while c(1) + c(2)*m <= 30 m = m + 1; end m
Output:
ans =
23.0667
m =
11
For month 7, €23.07. The loop starts at month 6 and moves forward while the line doesn’t go over 30; it stops at 11 (check: , and in month 10 it was 28.55).
e) (1) False: the rank of [U g] is 3. (2) Closest: is the shortest distance from to the subspace. (3) With more equations than unknowns, U \ g returns the least squares solution, the same coefficients as in b): that is what you get if you type U \ g directly.
Why it is done this way: in a) the ranks are used, not “let’s see whether U\g gives something”, because U\g always returns a number, even when there is no exact solution. And in d) the while changes m inside the loop, exactly what snippet 3 was missing.
The while in d), turn by turn:
| m | Line at m | Does it go on? | Why |
|---|---|---|---|
| 6 | 21.24 | yes | not over 30: m goes up to 7 |
| 7 to 9 | 23.07 · 24.90 · 26.72 | yes | each turn adds euros |
| 10 | 28.55 | yes | €1.45 still to go |
| 11 | 30.38 | no | the condition is false: the loop stops with m = 11 |
It comes out as 11 and not 10 because the while stops at the first month that does not meet the condition, and that is exactly the one that goes over 30. The obvious path would have been to solve for m: gives , and the first whole number is 11. It matches, but solving only works for a line; the loop works for any formula.
Quiz: read the code
Ten code-reading questions, like the ones in the lab assignment quizzes on the campus. Every output was checked with the interpreter.
What does this code print?
V = [1 2; 2 4; 0 1]; rank(V) == size(V, 2)
- ans = logical 1
- ans = logical 0
- ans = 2
- An error, because V is not square
Solution
Answer: ans = logical 1
The columns are (1, 2, 0) and (2, 4, 1): the third component breaks the proportion. Rank 2 with 2 columns: independent.
What does this code print?
t = 0; k = 1; while t < 10 t = t + k; k = k + 1; end k
- k = 5
- k = 4
- k = 10
- It never ends
Solution
Answer: k = 5
Iteration by iteration: t = 1, 3, 6, 10 and k = 2, 3, 4, 5. With t = 10 the condition t < 10 is false and the loop ends with k = 5.
What does this code print?
x = 0.1 + 0.2; disp(x == 0.3) disp(abs(x - 0.3) < 1e-10)
- 0 and then 1
- 1 and then 1
- 0 and then 0
- 1 and then 0
Solution
Answer: 0 and then 1
It is the same problem as with the dot products in snippet 2: decimals are compared with a tolerance.
If A is a 2 × 5 matrix of rank 2, how many columns does null(A, 'r') have?
- 3
- 2
- 5
- 7
Solution
Answer: 3
The basis of the kernel has as many vectors as free parameters: .
What does this code print?
u = [3; 4]; q = u / norm(u)
- q = [0.6000; 0.8000]
- q = [3; 4]
- q = 5
- q = [0.7500; 1.3333]
Solution
Answer: q = [0.6000; 0.8000]
and , a unit vector.
About the article’s my_gs function:
- If two columns of V are proportional, Q has fewer columns than V.
- Q always has the same number of columns as V.
- Q’*Q is the identity apart from rounding leftovers.
- Q*Q’ is always the identity.
Solution
- T — If two columns of V are proportional, Q has fewer columns than V.
- F — Q always has the same number of columns as V.
- T — Q’*Q is the identity apart from rounding leftovers.
- F — Q*Q’ is always the identity.
Q'*Q compares the columns with each other (orthonormal: identity). Q*Q' is the matrix of the projection onto the subspace, and it is only the identity if the subspace is the whole space.
What does this code print?
S = [1 2 1; 2 4 0; 0 0 1]; [~, piv] = rref(S); piv
- piv = 1 3
- piv = 1 2 3
- piv = 1 2
- piv = 2
Solution
Answer: piv = 1 3
The second output of rref tells you which columns have a pivot. S(:, piv) would be columns 1 and 3, which form a basis with original vectors.
Complete the projection of v onto the span of the columns of Q (orthonormal):
p = ____ * (____ * v);
Words:
- Q
- Q*Q
- inv(Q)
- Q'
- v
Solution
p = Q * (Q’ * v);
Q'*v gives the dot products and Q* uses them as the coefficients of the combination.
What does this code print?
G = [2 0; 0 1]; u = [1; 1]; v = [1; -2]; u' * G * v
- ans = 0
- ans = -1
- ans = 4
- A dimensions error
Solution
Answer: ans = 0
With the Gram matrix, . Orthogonal with one dot product doesn’t mean orthogonal with another.
Which of these loops end?
k = 1; while k < 5, k = k * 2; endfor k = 1:1000, endk = 0; while k ~= 1, k = k + 0.3; endk = 5; while k > 0, k = k + 1; end
Solution
Answer: k = 1; while k < 5, k = k * 2; end · for k = 1:1000, end
A while ends if what changes inside eventually makes the condition false. With decimals and ~=, it may never hit the exact value.
Try it in the MATLAB environment
Open the MATLAB environment, paste the script of exercise 3 and, at the end, my_gs and project. Then:
- Change the bills to yours and see in which month you would go over €30.
- Add a third column
month.^2toU: the projection is no longer a line but a parabola. Doesnorm(g - p)go down? - Call
my_gswithmagic(4): it has rank 3, so one column has to be skipped. - Remove the tolerance from
my_gs(if norm(w) == 0) and call it again with the repeated-column matrix: you’ll see an “almost zero” vector normalised into a meaningless direction.
For your lab assignments
Lab assignment 3 on the campus asks for bases of subspaces, implicit equations, the sum of subspaces and angles with a dot product given by a Gram matrix. This model script does all of that with the functions at the end; change only the data at the top.
%% Subspaces and dot product: template for lab assignment 3 format short A = [1 2 -1 1; 3 -1 2 -2]; % implicit equations of U (one row per equation) S1 = [1 0; 2 1; 0 1; 1 1]; % spanning set of U1 (in columns) S2 = [1 0; 3 1; 1 1; 2 0]; % spanning set of U2 (in columns) G = [2 1 0; 1 2 0; 0 0 1]; % Gram matrix of a dot product on R^3 %% 1. Basis of U from its implicit equations (with fractions) format rat BU = null(A, 'r') format short %% 2. Basis of U1 + U2 with original vectors BS = original_basis([S1 S2]) %% 3. Cosine and angle with the Gram matrix [co, ang] = gram_angle([1; 0; 1], [0; 1; 1], G) %% ---- functions (always at the end) ---- function B = original_basis(S) % Columns of S that form a basis of the subspace they span: % the ones with a pivot in the reduced row echelon form. [~, piv] = rref(S); B = S(:, piv); end function [co, ang] = gram_angle(u, v, G) % Cosine and angle (in degrees) between u and v with the dot product u'*G*v. co = (u' * G * v) / (sqrt(u' * G * u) * sqrt(v' * G * v)); ang = acosd(co); end
Output:
BU =
-3/7 3/7
5/7 -5/7
1 0
0 1
BS =
1 0 0
2 1 1
0 1 1
1 1 0
co =
0.6667
ang =
48.1897
What this script saves you in the quiz:
- Original vectors: here the first column of
S2is the sum of the two inS1, so it is redundant andBSkeeps three.[~, piv] = rref(S)returns in its second output the columns with a pivot, andS(:, piv)takes those original vectors, not the ones from the echelon form. It is the most failed question of this assignment. - The dot product with Gram is always
u'*G*v, withuandvas columns. The functiongram_angledoesn’t need to know whetherGis the identity or not. - Four decimals: the quiz compares with what
format shortshows. Copy the number as it comes out, without rounding it yourself.
What next?
If the loops or the functions with two outputs were hard, review the theory of this block, MATLAB intensive 2: vector spaces and Euclidean space. And the previous block, matrices and systems, has the my_gj you can use to decide dependencies by hand.
Cheat sheet: vector spaces in MATLAB
The essentials in 30 seconds: independence and membership are decided with rank; implicit equations are solved with null(A, 'r'); dot products are dot(u, v) or u'*G*v; and no decimal number is compared with ==, always with a tolerance.
| I want… | Code | Watch out |
|---|---|---|
| Independent? | rank(V) == size(V, 2) | Vectors in columns |
Is v in the subspace? | rank([V v]) == rank(V) | If it goes up, it isn’t |
| Basis from implicit equations | null(A, 'r') | Without 'r', an orthonormal basis with decimals |
| Basis with original vectors | [~, piv] = rref(S); S(:, piv) | Not the columns of the reduced form |
| Dot product | dot(u, v) or u'*G*v | With Gram, vectors as columns |
| Angle in degrees | acosd(co) | acos gives radians |
| Orthonormalise | my_gs(V) | orth(V) gives another valid basis |
| Projection | Q*(Q'*v) with orthonormal Q | Or U \ v for the coefficients |
| Almost zero? | abs(x) < 1e-10, norm(w) < 1e-10 | Never == 0 with decimals |
| Loop until something happens | while cond ... end | Something in cond must change inside |
Templates for the exercises:
- Gram-Schmidt: empty
Q→ for each column, subtract its projection on eachq→ if the norm is almost zero, skip → normalise and add. - Projection and line:
Uwith the column of ones and the variable → ranks to see if there is an exact solution →project→ orthogonal error withU'*r. - Search loop: starting value →
whilewith the opposite of the condition you are looking for → update inside → read the variable when it ends.
| Symptom | Likely cause |
|---|---|
Q'*Q is not the identity | You subtract the projection onto a non-unit vector |
| “Not orthogonal” for orthogonal vectors | You compare with == 0 |
| A basis with odd decimals (0.4472…) | null(A) without the 'r' |
cosd stops working | You called a variable cosd |
| The program doesn’t end | The while changes nothing in its condition |
Dimensions ... not consistent in u'*G*v | u or v as a row |
Before handing it in, ask yourself:
- Have I decided every dependency or membership with ranks, not by eye?
- Do all comparisons of decimal numbers have a tolerance?
- Are the basis vectors the original ones when the question asks for that?
- Have I copied the decimals exactly as
format shortshows them?
Did this article help you? Here is how you can support SergioLearns →
Block theory: Loops, bases, Gram-Schmidt and projectionVector spaces in MATLABCheat sheet: the block on one page, to reviewCheat sheetLab assignments: the block's functions and a model scriptFor your lab assignments


