I need to get counterlines outside the U.S. removed (Ocean/Canada/Mexico)! Se script below.
조회 수: 1 (최근 30일)
이전 댓글 표시
I am quite new in using map functions.
This is my simple start script:
clear all
close all
figure
ax = usamap({'CA','NY'});
LATLIM=[24 50]
LONLIM=[-125 -67]
usamap(LATLIM, LONLIM)
set(ax, 'Visible', 'off')
latlim = getm(ax, 'MapLatLimit');
lonlim = getm(ax, 'MapLonLimit');
states = shaperead('usastatehi',...
'UseGeoCoords', true, 'BoundingBox', [lonlim', latlim']);
geoshow(ax, states, 'FaceColor', [0.5 0.5 1])
latitude=linspace(min(LATLIM), max(LATLIM));
longitude=linspace(min(LONLIM), max(LONLIM));
n=1;
for i=1:100
for j=1:100
lat=latitude(i);
lin=longitude(j);
xlat(n)=lat;
ylon(n)=lin;
ozone(n)=exp(-((lat-30)^2/9000+(lin-(-100))^2/10000)); %test function
n=n+1;
end
end
% Create a grid of latitude and longitude
[LatGrid, LonGrid] = meshgrid(linspace(min(LATLIM), max(LATLIM)), ...
linspace(min(LONLIM), max(LONLIM)));
% Use griddata to compute ozone for each grid point
OzoneGrid = griddata(xlat, ylon, ozone, LatGrid, LonGrid);
% Call contourm
contourm(LatGrid, LonGrid, OzoneGrid);
댓글 수: 0
답변 (1개)
darova
2020년 4월 3일
Use handler options
% Call contourm
[~,h] = contourm(LatGrid, LonGrid, OzoneGrid);
h1 = get(h,'children'); % for older version
X = get(h1,'xdata');
Y = get(h1,'ydata');
댓글 수: 10
참고 항목
카테고리
Help Center 및 File Exchange에서 Denoising and Compression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!