Linear interpolation 4x2 matrix

Hi everyone,
I have a 4 by 2 matrix (2 columns and 4 rows), looking like this:
0.9259 0.9763
2.5383 2.5090
0.0424 -0.0161
-2.8423 -3.0047
By using linear interpolation, I would like to find out the values of all other rows IF the third row is zero.
The top row represents a horizontal distance , the second row represents the a horizontal velocity, the third row represents a vertical distance and the last one a vertical velocity. I want to find out what the horizontal distance, horizontal speed and vertical speed are IF vertical distance is 0 (which is somewhere between 0.0424 and -0.0161 which is why I need to use interpolation).
Apologizes in advance for my poor Matlab programming skills and my English,
Thank you for your help,
Best regards
Michael

 Accepted Answer

>> X
X =
0.9259 0.9763
2.5383 2.509
0.0424 -0.0161
-2.8423 -3.0047
>> f = -X(3,1) / (X(3,2) - X(3,1))
f =
0.724786324786325
>> Y = X(:,1) + f * (X(:,2) - X(:,1))
Y =
0.962429230769231
2.51706376068376
0
-2.9600052991453

More Answers (0)

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!