From: ravi on
HI,

I have the following 2 equations:

5a + 4b + 7c = 23
3a + 3b + 6c = 20

How can I retrieve unknown constants : a , b and c ?

Thanks
Ravi
From: Matt Fig on
A = [5 4 7;3 3 6];
b = [23;20];

x = A\b
From: Greg Heath on
On May 29, 8:04 pm, "ravi " <ravi_...(a)hotmail.com> wrote:
> HI,
>
> I have the following 2 equations:
>
> 5a + 4b + 7c = 23
> 3a + 3b + 6c = 20
>
> How can I retrieve unknown constants :  a , b and c ?

clear all, close all, clc

A = [ 5 4 7; 3 3 6 ]
b = [ 23; 20 ]

% A*x = b

rankA = rank(A) % 2
sizex = [ size(A,2) size(b,2)] %[ 3 1 ]
rankdef = sizex(1) - rankA % rank deficiency = 1
if rankdef > 0
disp('Nonunique Solution')
disp('Can arbitrarily set rankdef components of x to 0,')
disp('or can add any multiple of the unit null solution, ')
disp('x0, where A*x0 = 0, norm(x0) = 1')
end
x0 = null(A) % [ 0.30151 -0.90453 0.30151 ]'
normx0 = norm(x0) % sqrt(sum(x0.^2)) = 1
e0 = A*x0 % [ 0 2.2204e-016 ]'

% The "BASIC" solution.
% Number of zero solution components >= rankdef

xb = A\b % [ -0.22222 0 3.4444 ]'
msexb = mse(A*xb-b) % 0
normxb = norm(xb) % 3.4516

% The "MINIMUM NORM" solution.
% No solution of the form x = xb + const*x0 will have
% a smaller norm than xmn

xmn = pinv(A)*b % [ -0.51515 0.87879 3.1515 ]'
msexmn = mse(A*xmn-b) % 6.3109e-30
normxmn = norm(xmn) % 3.3121

Hope this helps.

Greg