How to interpolate data

2 views (last 30 days)
hj lee on 9 Nov 2020
Commented: hj lee on 12 Nov 2020
Hello,
P=[NaN NaN NaN 163.626652810406 140.245221578496 143.291946126177 158.198843187782 179.073274059170 206.654075204109 255.461365237779 318.955295177489 396.993670297888 486.124439415540 587.818128810315 703.723462252509 831.059610098512 974.884947235331 1136.56020938783 NaN NaN] : it is 1*20 double
V= [148.527280000000 166.471365263158 184.415450526316 202.359535789474 220.303621052632 238.247706315790 256.191791578947 274.135876842105 292.079962105263 310.024047368421 327.968132631579 345.912217894737 363.856303157895 381.800388421053 399.744473684211 417.688558947368 435.632644210526 453.576729473684 471.520814736842 489.464900000000]
I want to know the specific V data when P is 500.
I try to use
V_specific = interp1(P,V,500);
but there is error message, I don't know what is the problem.
is there any methods to solve this problem?
Thanks

Sylvain on 9 Nov 2020
interp1 inputs must be real number (look at the section input arguments from the help.). Thus remove the NaN values from the input.
V_specific = interp1(P(4:end-3),V(4:end-3),500)
hj lee on 12 Nov 2020
Thans you very much!

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!