Multivariate fitting of linear equation

I want to do multivariable fitting for the following linear equation
P = K * T
Where:
P is matix of known and controlled variable
T is matix of known, measured variable
K is the matrix of unknown coefficients
P is 4x1 matrix
P = [P1; P2; P3; P4]
K is 4X6 matrix
K = [K1_1 K1_2 K1_3 K1_4 K1_5 K1_6;
K2_1 K2_2 K2_3 K2_4 K2_5 K2_6;
K3_1 K3_2 K3_3 K3_4 K3_5 K3_6;
K4_1 K4_2 K4_3 K4_4 K4_5 K4_6]
T is 6x1 matrix
T = [T1; T2; T3; T4; T5; T6]
I have readings at multiple values of P (aprox 68) and similarly (aprox 68) reading for T at each P value.
How can I do this?

Answers (1)

Your system is underdetermined system, there is only 4 equations for 6 unknowns.
There exists not only one solution but infinite solutions (difference belong to a vectorial space of dimension at least 2).
To pick one solution you can do
T_A = lsqminnorm(K, P)
or
T_B = K\P
Any vector of the form
N = null(K)
T_A + N * x % or T_B + N * x
where x is an arbitrary vector of size (size(N,2),1) will be solution of your problem

2 Comments

I know the values of P and the resulting values of T (from measurment)(linear relation). I want to find the value for K that best fits these values of P and T.
T=rand(5,1);
P=rand(4,1)
P = 4×1
0.3629 0.5981 0.2752 0.8331
K=T'.*(P./(T'*T));
K*T
ans = 4×1
0.3629 0.5981 0.2752 0.8331

Sign in to comment.

Categories

Find more on Geology in Help Center and File Exchange

Products

Asked:

on 10 Sep 2023

Commented:

on 13 Sep 2023

Community Treasure Hunt

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

Start Hunting!