Linear equation minimization problem
显示 更早的评论
Hello,
I have the folowing matrix:
A=[1 1 1
1 1 0
1 0 0
0 1 1
0 0 1];
I need to find a vector b [ x1,x2,x3,x4,x5],
such that the answer will be as close to [4,6,7] (minimization of error between the answer and the achieved goal).
Is there any convient way to do it in matlab?
回答(1 个)
Alan Stevens
2020-8-29
Like so:
>> A=[1 1 1
1 1 0
1 0 0
0 1 1
0 0 1]
>> V = [4 6 7]
A =
1 1 1
1 1 0
1 0 0
0 1 1
0 0 1
V =
4 6 7
>> R = V/A
R =
5.0000 -1.0000 0 2.0000 0
>> R*A
ans =
4.0000 6.0000 7.0000
类别
在 帮助中心 和 File Exchange 中查找有关 Linear Algebra 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!