Interpolating scattered data within a shapefile/worldmap

조회 수: 4 (최근 30일)
SChow
SChow 2020년 3월 30일
댓글: SChow 2020년 3월 31일
Hi I have x,y,zi scattered data, where x is lon, y is lat and zi is the data, I want to interpolate and extrapolate the data within the land boundaries, I used
vq = griddata(x,y,zi,xi,yi);
However, the interpolation and extrapolation was not made as desired.
  댓글 수: 2
BN
BN 2020년 3월 30일
편집: BN 2020년 3월 30일
Use scatteredInterpolant (https://www.mathworks.com/help/matlab/ref/scatteredinterpolant.html). It is very similar to griddata but I guess it inter polate across all area that you want.
SChow
SChow 2020년 3월 30일
I have tried using scatteredinterpolant, it does not work. Please find the attached file of scattered data.
clc
clear
[LAT LON]=cdtgrid(1.875);%%making meshgrid for desired data
obs_data=xlsread('Z:\CP_c.csv');
loni = obs_data(:,2) ;
lati = obs_data(:,1) ;
% zi = interp2(LONi,LATi,xi,loni,lati) ;
F=scatteredInterpolant(loni,lati,obs_data(:,5),'linear','linear');
F.Method = 'linear';
vq1 = F(LAT,LON);
imagesc(vq1)

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

답변 (1개)

darova
darova 2020년 3월 30일
Here is my effort. Am i succeeded?
S = importdata('CP_c.csv');
A = S.data;
x = A(:,1);
y = A(:,2);
z = A(:,3);
xx = linspace(min(x),max(x),20);
yy = linspace(min(y),max(y),20);
[X,Y] = meshgrid(xx,yy);
Z = griddata(x,y,z,X,Y);
surf(X,Y,Z)
  댓글 수: 8
darova
darova 2020년 3월 30일
You don't have points for RUssia and Mexico
SChow
SChow 2020년 3월 31일
Yes, that is why I want to interpolate the data to Mexico and Russia.

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

카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by