Contour lines do not agree with data points

조회 수: 3 (최근 30일)
Mark Larson
Mark Larson 2013년 7월 1일
Hi all,
I am having some funky issues with contourf (and other contour functions).
See image for best description, but basically I am trying to contour very poorly distributed points (i.e. clustered in two places, and randomly distributed elsewhere). I am having trouble getting the contour intervals to make sense with the data. As the image shows, (the size of the squares indicates the magnitude of the Z value) the contours don't really fit the data around the clustered area, and for whatever reason it creates two bulls-eyes in the middle of "nowhere."
I am using M_Map http://www.eos.ubc.ca/~rich/map.html , a set of routines that assist Geoscientists in plotting maps of the earth. But I don't believe that this is the cause of error.
Attempts at fixing : -re gridded with many values. -tried different contour functions (some worked some did not) -tried different contour methods
-----start code
[X1,Y1]=m_ll2xy(lonmin,latmin);
[X2,Y2]=m_ll2xy(lonmax,latmax);
[xq,yq] = meshgrid(X1:.001:X2, Y1:.001:Y2);
for i=1:3:length(D2)
[X,Y]=m_ll2xy(lon(i),lat(i));
xx(i)=X;
yy(i)=Y;
end
AmplMatr = griddata(xx,yy,maxtmpZ,xq,yq,'cubic'); %construct a Matrix of the Amplitudes of the seismic waves
AmplMatr(isnan(AmplMatr)) = 0 ; %Because NaN values cause issues
contourf(xq,yq,AmplMatr);
----end code

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by