How to Interpolate an entire data set.I have two datasets and I am trying to determine tidal energy for the lat and lon values of my elasmobranch sightings. Since teh specific sighting lat and lon dont exist in my tidal data I am trying to interpolate them.
I have tried interpolting each value seperatly, but I recieve a value of 0. I've tried both interp1 and interp2
Tides=readtable('Tide_Data_Final.csv')
C = Tides.Longitude
M= Tides.Latitude
A=Tides.Tide
F=scatteredInterpolant(C,M,A);
Anew= F(52.00,-6.00);
figure(1)
stem3(C,M, A)
hold on
stem3(52.000,-6.00, Anew, 'r')
hold off
grid on
xlabel('\sigma')
ylabel('\alpha')
interp2(C,M,A,52.000,-6.000)

댓글 수: 4

Star Strider
Star Strider 2023년 8월 1일
Shark Week!
Uploading Tide_Data_Final.csv would be helpful.
Torsten
Torsten 2023년 8월 1일
편집: Torsten 2023년 8월 1일
Usually F(52,-6) should suffice to get an interpolated value at (lontitudeq,latitudeq) = (52.000,-6.000).
Madison
Madison 2023년 8월 1일
The data ius now linked, thank you
Madison
Madison 2023년 8월 1일
When I use scatteredInterpolant the value only returns with an interpolated value of 0 and I know the value is not 0 for every lat and long camobination.

댓글을 달려면 로그인하십시오.

 채택된 답변

dpb
dpb 2023년 8월 1일
이동: dpb 2023년 8월 1일

0 개 추천

unzip Tide_Data_Final
Tides=readtable('Tide_Data_Final.csv');
head(Tides)
Longitude Latitude Tide _________ ________ ____ -7 50.5 0 -7 50.505 0 -7 50.511 0 -7 50.516 0 -7 50.521 0 -7 50.526 0 -7 50.532 0 -7 50.537 0
nnz(Tides.Tide)
ans = 283644
height(Tides)
ans = 562856
F=scatteredInterpolant(Tides.Latitude,Tides.Longitude,Tides.Tide);
Tnew= F(52.00,-6.00)
Tnew = 0.7983
You have a perfectly good table with real variable names; use it/them.
You created another set of variables C,M,A with no relation at all to the actual data and turned the reference to lat, lon around by doing so and couldn't see the obvious since the new variable names bore no relationship to the actual data.

추가 답변 (1개)

Torsten
Torsten 2023년 8월 1일
편집: Torsten 2023년 8월 1일

0 개 추천

I think you interchanged latitude and longitude in your call. It should be
Anew= F(-6.00,52.00);
instead of
Anew= F(52.00,-6.00);
which should give something around
Anew = 0.7983

카테고리

도움말 센터File Exchange에서 Interpolation에 대해 자세히 알아보기

제품

릴리스

R2023a

태그

질문:

2023년 8월 1일

댓글:

2023년 8월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by