Finding the Value between meassured points with the Fitting Toolbox

2 views (last 30 days)
Hello Community,
for my project I measured special values on several points in an 3D Coordinationsystem. Now I created a graph by using the fitting toolbox and put an in plate spine in between the measuered points. My Question now is, that if i just have values for the mesured points(for example P1(1/2)=3, P2(1/3)=5 P3(3/4)=5 P4(4/3)=4) is there a possibillity to find the value of a point i didnt mesured(P5(3,5/3,5))? It would be easiest finding the value by simply clicking on the desired point on the surface.

Answers (1)

Rishabh Mishra
Rishabh Mishra on 23 Dec 2020
Edited: Rishabh Mishra on 23 Dec 2020
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:
  1. P1(½,0,0) = 3
  2. P2(0,1/3,0) = 5
  3. P3(0,0,3/4) = 5
  4. P4(0,4/3,0) = 4
Follow the steps listed below:
  1. Create column array for x, y, z coordinates & the values.
  2. Apply ‘polyfit’ function to obtain co-efficient values.
  3. 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!

Community Treasure Hunt

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

Start Hunting!