No BSD License

### Highlights from Introduction to Linear Algebra

• BASIS(A)BASIS Basis for the column space.
• addvec(v,w)ADDVEC Illustrate the sum v + w of 2-dimensional vectors.
• atimesv(a,v)atimesv displays a two-dimensional
• cofactor(A,i,j)COFACTOR Cofactors and the cofactor matrix.
• cosineCOSINE Illustrates cosine formula and dot products.
• cramer(A,b)CRAMER Solve linear system by Cramer's Rule.
• determ(A)DETERM Matrix determinant from PLU.
• eigen(A)EIGEN Describe eigenvalues and eigenvectors.
• eigen2(a)EIGEN2 Two by two eigenvalues and eigenvectors.
• fastfour(x)FASTFOUR Fast Fourier Transform.
• findpiv(A,k,p,tol)FINDPIV Used by PLU to find a pivot for Gaussian elimination.
• grams(A)GRAMS Gram-Schmidt orthogonalization.
• inverse(A)INVERT Matrix inverse by Gauss Jordan elimination.
• linefit(t,b)LINEFIT Plot the least squares fit by a line.
• linprog(A,b,c,k,maxit,tol)LINPROG This code uses the revised simplex method to solve the linear
• lsq(A,b)LSQ Least squares.
• null(A)NULL Nullspace of a matrix
• permdet(p)PERMDET Determinant of a permutation.
• plot2d(X)PLOT2D Two dimensional plot.
• plu(A)PLU Pivoting, rectangular, LU factorization.
• poly2str(c,x)POLY2STR Convert a polynomial coefficient vector to a string.
• power(A,v,n)POWER Execute the power method on a 2 by 2 matrix A
• projmat(A)PROJMAT Projection matrix onto the column space.
• randperm(n)RANDPERM Random permutation.
• rats(A)RATS Print in "rational" form.
• ref(A)REF Reduced Row Echelon Form.
• signperm(p)SIGNPERM Sign of a permutation.
• slu(A)SLU Simple, square, LU factorization.
• slv(A,b)SLV Simple linear equation solver.
• solve(A,b)SOLVE Particular solution to a system of simultaneous linear equations.
• splu(A)SPLU Square LU factorization with row exchanges.
• splv(A,b)SPLV The solution to a square, invertible system.
• Contents.mStrang Linear Algebra Toolbox
• Readme.mINTRODUCTION TO LINEAR ALGEBRA TOOLBOX
• expage35.mEXPAGE35 Tutorial of Markov programming exercise.
• expage36.mMARKOV2 Tutorial of Markov programming exercise.
• expower.mEXPOWER demonstrates the power method of finding the dominant eigenvalue
• fourier.mThis code starts by creating the Fourier matrix.
• hand.m"Hand" data set for use with plot2d.
• house.m"House" data set: The 2 by 12 matrix for the coordinates of the
• movies.mMATLAB has a "movie" to show how elimination reaches the
• sixpack.mSIXPACK shows the six orderings for the loops in matrix multiplication.
• xbasis.mA basis consists of independent vectors whose combinations produce the whole
• xcofactor.m
• xcramer.mCramer's Rule solves Ax = b by determinants. The j-th component of the
• xdeterm.mStart with the determinant of a pascal matrix that has the pascal
• xeigen.mThis code uses the power of MATLAB's eig program to find eigenvalues
• xeigen2.mThis code gives the eigenvalues and eigenvectors of a 2 by 2 matrix.
• xfindpiv.mThis is about the function FINDPIV, which is used by the PLU function
• xgrams.mThe Gram-Schmidt process starts with independent vectors in the columns of A
• xinverse.mThe inverse of A is here computed by Gauss-Jordan elimination on [A I].
• xlinefit.mThe linefit program draws the closest (least squares) line to a set of points
• xlsq.m
• xnull.mThe nullspace matrix N contains the "special solutions" to Ax=0.
• xpermdet.mThe determinant of a permutation matrix is always 1 or -1. This is also
• xplot2d.mThe front cover of the book shows "houses" that were drawn using plot2d.
• xplu.mEvery matrix allows the factorization PA = LU. If A is square and invertible
• xprojmat.mStart with random matrices and project onto their column spaces.
• xrandperm.m
• xrats.mThis code gives the output in terms of FRACTIONS instead of decimals.
• xref.m% For every matrix A, the reduced echelon form R has all pivots = 1 and zeros
• xsignperm.mA permutation can be given two ways - as a series of numbers p or a matrix P.
• xslu.m
• xslv.mThe solve program slv uses slu to factor A into L*U. The matrix A must
• xsolve.mChoose a square matrix with dependent columns u, v, w.
• xsplu.mChoose a matrix with zeros on its diagonal:
• xsplv.m
• zeroone.mThis program creates matrices with 0's and 1's at random. It counts the
• View all files

# Introduction to Linear Algebra

### Gilbert Strang (view profile)

20 Aug 2002 (Updated )

Companion Software

atimesv(a,v)
```function atimesv(a,v)
%       atimesv  displays a two-dimensional
%       plot of the scalar-vector product a*v,
%       where a is a real scalar and v is a two
%       dimensional real vector.
%
%       This function displays a plot of a*v
%       following the illustration of Figure 1.1 in G. Strang,
%       "Introduction to Linear Algebra."

% Written by T. A. Bryan on 2 June 1993

x=a*v;

hold off
clg
plot([0 v(1)],[0,v(2)],':',...
[0 x(1)],[0,x(2)],'-')
hold on
text(v(1),v(2),'v')
text(x(1),x(2),[num2str(a) '*v'])

hold off

```

Contact us