user3087937
user3087937

Reputation: 45

Finding an optimum solution that simultaneously satisfies multiple equations

I would like to find a single variable that optimizes the solution of two equations. For instance, Target1=b*y1 and Target2=b*y2. I need to find a single b coefficient that simultaneously satisfies these equations.

How can I find the coefficient?

Upvotes: 1

Views: 70

Answers (1)

FangQ
FangQ

Reputation: 1544

this is called least square; the least square solution to

y1*b=target1
y2*b=target2

is

b=[y1;y2]\[target1;target2]

which is equivalently solving the pseudo-inversion of the above equation by

A=[y1;y2];
b=inv(A'*A)*A'*[target1;target2]

Upvotes: 3

Related Questions