Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %%Intro
- %Setup constants and formatting
- clear all
- clc
- digits(5);
- MatrixRows = 5;
- MatrixCols = 7;
- VectorSize = 7;
- %Setup random number generator
- rand('state', sum(clock*100));
- %Generate matrix A and vector u
- A = vpa(rand(MatrixRows,MatrixCols));
- u = vpa(rand(VectorSize,1));
- %%Body
- %Put matrix A into REF
- A = rref(A)
- %Calculate the product b = Au
- b = A*u
- %Solve for x by setting x = A\b
- x = A\b
- %Show augmented matrix produced by Ax = b or Au = b
- U = rref([A b])
- %%Conclusion
- %Computing b as the product of A and u, we were able to solve for u by
- %divinding A by b.
- %Matlab shows b == x only when digits() or vpa() are on.
- %There are infinitely many solutions because A has 2 free variables,
- %corresponding to the last 2 columns.
Add Comment
Please, Sign In to add comment