How to interpolate data

1 回表示 (過去 30 日間)
hj lee
hj lee 2020 年 11 月 9 日
コメント済み: hj lee 2020 年 11 月 12 日
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
Sylvain 2020 年 11 月 9 日
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)
  1 件のコメント
hj lee
hj lee 2020 年 11 月 12 日
Thans you very much!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by