Mon 15 May 2017 05:40:54 PM UTC, original submission:
When running the following commands:
X = [120 60 0]'
v0 = [
[ 5.4410e+03 4.8674e+03 5.1208e+03 1.2981e+04 1.2407e+04 1.2661e+04 1.8651e+04 1.8077e+04 1.8331e+04]
[ 4.0110e+03 3.6304e+03 3.8449e+03 1.0423e+04 1.0043e+04 1.0257e+04 1.5951e+04 1.5570e+04 1.5785e+04]
[-3.0221e+02 -1.4564e+01 0.0000e+00 -3.0221e+02 -1.4564e+01 0.0000e+00 -3.0221e+02 -1.4564e+01 0.0000e+00]
]
x1 = -3.1623
interp1(X,v0,x1,'linear')
Octave 4.0.0 returns:
ans =
Columns 1 through 6:
NA -206.67 -202.65 -867.48 -544.65 -540.60
Columns 7 through 9:
-1158.84 -835.95 -831.95
Only the first value is NA, when they should all be NA.
When I run the same values (the first 2 columns) manually, they both return NA as expected:
interp1([120 60 0], [5.4410e+03 4.0110e+03 -3.0221e+02], -3.1623, 'linear')
ans = NA
interp1([120 60 0], [4.8674e+03 3.6304e+03 -1.4564e+01], -3.1623, 'linear')
ans = NA
Matlab returns the correct results as well:
>> X = [120 60 0]';
>> v0 = [
[ 5.4410e+03 4.8674e+03 5.1208e+03 1.2981e+04 1.2407e+04 1.2661e+04 1.8651e+04 1.8077e+04 1.8331e+04]
[ 4.0110e+03 3.6304e+03 3.8449e+03 1.0423e+04 1.0043e+04 1.0257e+04 1.5951e+04 1.5570e+04 1.5785e+04]
[-3.0221e+02 -1.4564e+01 0.0000e+00 -3.0221e+02 -1.4564e+01 0.0000e+00 -3.0221e+02 -1.4564e+01 0.0000e+00]
];
>> x1 = -3.1623;
>> interp1(X,v0,x1,'linear')
ans =
NaN NaN NaN NaN NaN NaN NaN NaN NaN
|