How to fill the discontinuities in this plot??
1 view (last 30 days)
Show older comments
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
0 Comments
Accepted Answer
Walter Roberson
on 4 Feb 2014
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'.
More Answers (0)
See Also
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!