How to fill the discontinuities in this plot??

1 次查看(过去 30 天)
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 中查找有关 Interpolation 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by