Oh! I got the answer by using 'scatteredInterpolant'.
Contourfm within bounding box
3 views (last 30 days)
Show older comments
Hi,
I have a shapefile containing the coastline of my study region. I would like to spatially interpolate elevation such that all areas within the coastline, and not just the points where data is available, are filled.
Here is what I have so far. Something is definitely wrong. I can see the color bar and not the contour filled image as my output.
Please help. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
figure
[LONG, LAT]=meshgrid(linspace(min(long),max(long)),linspace(min(lat),max(lat)));
F = TriScatteredInterp(long,lat,elev);
qz = F(LONG,LAT);
axesm('MapProjection','lambert', 'MapParallels',[],...
'MapLatLimit',[48 61], 'MapLonLimit',[-122 -89]+360)
geoshow('PrairiesBoundaries.shp', 'DisplayType','polygon','FaceColor','none', 'EdgeColor','none')
hold on
[cs,h]=contourfm(LONG,LAT,qz,'.b','LineWidth',1.3);
clabel(cs,h,'fontsize',12);
hcb = colorbar('horiz');
set(get(hcb,'Xlabel'),'String','elevation')
Answers (0)
See Also
Categories
Find more on Contour Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!