Last active
August 29, 2015 14:01
-
-
Save iveney/24f93c1e89dc46fe3b89 to your computer and use it in GitHub Desktop.
Solutions to under-constrained linear system
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> rng(0) | |
>> A=randi(10, 2, 5); b=randi(100, 2, 1); | |
% A = b = | |
% 9 7 8 7 8 28 | |
% 10 8 4 2 1 5 | |
>> x1=A\b; x2=pinv(A)*b | |
% x1 = x2 = | |
% 0 1.5675 | |
% 10.2500 6.1976 | |
% 0 -3.8780 | |
% 0 2.5279 | |
% -0.4500 0.9060 | |
>> b1=A*x1; b2=A*x2; | |
% b1 = b2 = | |
% 16.0000 16.0000 | |
% 98.0000 98.0000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment