How to fill the discontinuities in this plot??

조회 수: 6 (최근 30일)
Rizwana
Rizwana 2014년 2월 4일
댓글: Rizwana 2014년 2월 4일
Why iam not able to get contours throughout the region??
Set of commands
a = new;
r = linspace(24.94,27.30,264);
x =r';
y =a(:,1);
z =a(:,2);
X = 24.94:0.1:27.30;
Y = 0:0.1:9;
[X,Y] = meshgrid(X,Y);
Z = griddata(x.*cos(a(:,1)*pi/180),...
x.*sin(a(:,1)*pi/180),a(:,2),X,Y);
contourf(Y,X,Z,1.25:0.025:max(a(:,2)),'b')
axis off

채택된 답변

Walter Roberson
Walter Roberson 2014년 2월 4일
We need more information about the value of "new".
One thing to watch out for is that the default 'linear' method does not extrapolate: only points interior to your "a" can be interpolated and points outside what "a" defines are going to be NaN. You could try specifying a different method but it is not clear that it will help.
If this is the problem then you could switch to the relatively new griddedinterpolant. But watch out for your MATLAB version:
The behavior of griddedInterpolant has changed. All interpolation methods now support extrapolation by default. Set F.ExtrapolationMethod to 'none' to preserve the pre-R2013a behavior when F.Method is 'linear', 'cubic' or 'nearest'. Before R2013a, evaluation returned NaN values at query points outside the domain when F.Method was set to 'linear', 'cubic' or 'nearest'.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by