2-D interpolation with extrapolation value for out of range data.

13 ビュー (過去 30 日間)
Zee
Zee 2022 年 4 月 26 日
編集済み: Matt J 2022 年 4 月 26 日
Hello,
I would like to do 2-D polar interpolation for the points shown in the file. For the interpolation, I considered azimuth as X and elevation as Y with r as sample values V. X and Y values are indicated in radians.I would like to carry out interpolation for query points within the range of available dataset. However if my query point for Y lies outside the range then I would like to interpolate between these end values instead of extrapolating. Range for my query point for Y would be between 0 to 6.28 (ie 0 to 360 degree)
For instance if for a given X value from the file has the following corresponding Y and V values,
X1 = 0.348, Y1 = 6.067, V1= 49157.12
X2 = 0.348, Y2 = 0.2158, V2= 49157.12
Then I should get V3 as 49157.12 if my query points xq1 = 0.348 and yq1 = 6.1.
Whereas if I use griddata function its extrapolating the values and giving V3 as 50525. Interp2 function has an option to provide extravapval as nearest to get something what I am looking for but am not sure if thats the right function to use. Also am getting error for my input arguments while using Interp2 function that my values are not strictly monotonic. I tried to convert X and Y values as mesh grid but am still getting error.

回答 (1 件)

Matt J
Matt J 2022 年 4 月 26 日
編集済み: Matt J 2022 年 4 月 26 日
Map X,Y to equivalent points that are always in bounds,
[u,v,w]=sph2cart(X,Y,1);
[X,Y]=cart2sph(u,v,w);

カテゴリ

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

製品


リリース

R2011b

Community Treasure Hunt

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

Start Hunting!

Translated by