Interpolate p1(x1, y1, z1), p2(x2, y2, z2), find x and y when z = 0

1 view (last 30 days)
I've 2 two 3-dimensional points:
(x1=18.1009988576007, y1=8.98615800401940, z1=0.0383777665716703)
(x2=18.1467590941979, y2=9.05076591949910, z2=-0.0425807020243865)
I want to interpolate this and get the value of x and y when z = 0. I don't know how I should it.
Thanks!

Answers (1)

Stephen23
Stephen23 on 15 May 2017
Edited: Stephen23 on 15 May 2017
>> x1=18.1009988576007; y1=8.98615800401940; z1=+0.0383777665716703;
>> x2=18.1467590941979; y2=9.05076591949910; z2=-0.0425807020243865;
>> fun = @(x)interp1([0,1],[z1,z2],x);
>> k = fzero(fun,[0,1]);
>> x3 = x1+(x2-x1)*k
x3 =
18.1226911611836
>> y3 = y1+(y2-y1)*k
y3 =
9.01678491114796

Categories

Find more on Interpolation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!