Looking for a function f(x,y,z) based on 3 points to calculate interpolat​ed/extrapo​lated values with a linear relation

1 Ansicht (letzte 30 Tage)
Hello together, I am new to this forum and just starting using Matlab. Hope you could help me with my problem.
I have a "scattered" set of points with coordinates (x,y,z) that lie all in a plane.
For 3 points I have a certain measurement value. There is a linear relation between the measurement values.
Now I want to calculate the values for the remaining points.
I tried 'scatteredInterpolant', 'interpn' and 'griddatan' without any success.
Do you have any suggestions for the solution?
Thank you and regards
Eugen

Akzeptierte Antwort

David Goodmanson
David Goodmanson am 15 Jun. 2019
Bearbeitet: David Goodmanson am 15 Jun. 2019
HI Appli,
This is something Matlab does really well. I assume by 'linear relation' you mean that each point has a value
c = a1*x + a2*y + a3*z with the a's to be determined. Denoting the coordinates of the three known points by p,q,r rather than x,y,z, you have the three equations
a1*p1 + a2*q1 + a3*r1 = c1
a1*p2 + a2*q2 + a3*r2 = c2
a1*p3 + a2*q3 + a3*r3 = c3
i.e. the matrix eqn. P*A = C where
P = [p1 q1 r1;
p2 q2 r2;
p3 q3 r3]
A = [a1; a2; a3] % column vector
C = [c1; c2; c3] % column vector
After constructing P and C with known values, this is solved in one line as
A = P\C
and once A is known, the rest of the C values (n of them, say) are determined by setting up the nx3 matrix
X = [x1 y1 z1;
. ..
xn yn zn]
Then
C = X*A
provides the n the values of c.

Weitere Antworten (0)

Kategorien

Mehr zu Interpolation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by