How to use solve() method to find out linear equation

Hi, is there any method beside solve() that can find out the variable x y z like below which i would the variable and the input output( all the numbers below) need to be mat.

I have try with matrix<> but i cannot accept matrix<Matrix < float > > and also array of Mat but the solve method cannot accept mat[];

i need this equation is to find the phase to height converstion used in unwrapped method which need to find the consant a,b,c of the method below by using 3 known value equations. which can be formed as matrix like the image attached above

that sounds very confused and makes no sense at all.

look for examples. there must be examples you can use.

1 Like

i been searching for examples but none of it can be use

a very simple example based on this

float a[3][3] = {{ 3, 2,-1},
	             {2, -2, 4},
	             {-1, 0.5, -1}};
float b[3][1] = { {1},
	              {0} };

Mat A = Mat(3,3 ,CV_32FC1, a);
Mat B = Mat(3,1, CV_32FC1, b);

Mat x = A.inv() * B;
cout << "x=" << endl << " " << x << endl;

Mat y;
cout << "y=" << endl << " " << y << endl;


(and the Matrix<> confusion probably comes fom ppl mixing in Eigen code)