フィルターのクリア

interpolating longitudes from latitude

2 ビュー (過去 30 日間)
Gillian Goldhagen
Gillian Goldhagen 2020 年 6 月 16 日
回答済み: Sujay C Sharma 2020 年 6 月 17 日
I have a bunch of lattitudes and longitudes that make up a specific shape with some latitudes and longitudes being repeated.
I need to find a way to interpolate what latitudes would be at a given lattitude point from 40.5-43.5 every .1 interval. My actual data is much more specific with few lattitude points actually at simple numbers and most looking like this: 43.2930.
Is it possible to get this information from my dataset of 536x2 lat and long?
I have tried sorting my data: sorteddata=sortrows(data,[1,2]);
to be able to use: newlon=intrplon(sorteddata(:,1), sorteddata(:,2), 40.5)
but it won't go through I assume since I have multiples of both lat and long.
It keeps giving me this error: Error using intrplon (line 61)
LATITUDE must be monotonic.
Any advice would be great, thank you.

回答 (1 件)

Sujay C Sharma
Sujay C Sharma 2020 年 6 月 17 日
Hi,
The polyfit and polyval functions may be able to help you out in this regard. Here is an example of how you can use it for interpolation:
X = [1:10];
Y = [1:10];
c = polyfit(X,Y,1);
Input = [10:0.1:11];
Output = polyval(c,Input);
disp(Output);
Your latitudes and longitudes from your dataset can be used in place of X and Y and your Input would be [40.5:0.1:43.5] in your case. Do take a look at the documentation of polyfit and polyval for more examples

カテゴリ

Help Center および File ExchangeInterpolation of 2-D Selections in 3-D Grids についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by