Can someone help with this code to solve the Linear Algera problem?
显示 更早的评论
For each system of linear algebraic equations,determine if the system is underdetermined, has an exactsolution, or is overdetermined. If the system is underdetermined, find the general solution using the RREF function and then find a particular solution and check your answer. If the system is exact,find the unique solution and check your answer.If the system is overdetermined, find a least squares solution.
a)
x1-x2+x3-x4=3
3x1+2x2-4x3+x4=2
-x1+5x2+2x3+3x4=4
4x1+x2-3x3=5
b)
x1-x2+x3-x4=3
3x1+2x2-4x3+x4=2
-x1+5x2+2x3+3x4=4
4x1+x2-3x3+2x4=-1
c)
x1-x2+x3-x4=3
3x1+2x2-4x3+x4=2
-x1+5x2+2x3+3x4=4
4x1+x2-3x3=7
2 个评论
James Tursa
2018-4-26
What have you done so far? What specific problems are you having with your code?
Soren Carpenter
2018-4-26
回答(1 个)
Start with converting the equations to one matrix equation:
x1-x2+x3-x4=3
3x1+2x2-4x3+x4=2
-x1+5x2+2x3+3x4=4
4x1+x2-3x3=5
To:
A = [1, -1, 1, -1; ...
3, 2, -4, 1; ...
-1, 5, 2, 3; ...
4, 1, -3, 0];
b = [3; 2; 4; 5]
Now you want to solve:
A*x = b
类别
在 帮助中心 和 File Exchange 中查找有关 Linear Algebra 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!