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?

Antworten (1)

Alan Stevens
Alan Stevens am 29 Aug. 2020

0 Stimmen

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

Gefragt:

am 29 Aug. 2020

Beantwortet:

am 29 Aug. 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by