Hi,
Since you are dealing with 3D coordinate system. It is important to specify all 3 coordinates (x,y,z) while specifying the values. For example, it should be P1(½,0,0) = 3 instead of P1(½) = 3.
From the description you provided, I would like to make following assumptions:
- P1(½,0,0) = 3
- P2(0,1/3,0) = 5
- P3(0,0,3/4) = 5
- P4(0,4/3,0) = 4
Follow the steps listed below:
- Create column array for x, y, z coordinates & the values.
- Apply ‘polyfit’ function to obtain co-efficient values.
- Using these co-efficient values, value at P5(3,5/3,5) can be calculated.
x = [1/2;0;0;0];
y = [0;1/3;0;4/3];
z = [0;0;3/4;0];
val = [3;5;5;4];
p = polyfitn([x y z],val,'x, y, z');
‘p.Coefficients’ contains the values of all the coefficients.
Hope this helps!