Linear equation minimization problem
Show older comments
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?
Answers (1)
Alan Stevens
on 29 Aug 2020
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
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!