Unable to get similar contour using the gridfit
Show older comments
I am trying to plot countour filled for the data- i got a contour using the tri-contour- gives lines,
tri = delaunay(y1,z1); %A 2-D Delaunay triangulation ensures that the circumcircle associated with each triangle contains no other point in its interior
tricontour(tri,y1,z1,log10(mass2*1e6),contourlevel);

Since i need the colormap form plot: I used the gridfit to achieve that, but getting different plot nature
x_node= -50:01: 50;
y_node= -100:01: 0;
% % techniques to fit the function to the grid points
% % it reduces the data points to get you less levels
[zg,xg,yg] = gridfit(y1,z1,(log10(mass2*1e6)),x_node,y_node,'interp', 'nearest');
contourf(xg,yg,zg,50)

Accepted Answer
More Answers (1)
John D'Errico
on 19 Sep 2015
0 votes
I just saw this question. I'll add a few comments as the author of gridfit, but I've already upvoted Kelly's response. I could have just put what I have to say in as a comment, but I hope that some of what I can say is worth reading, and might be easier to notice as an answer.
Gridfit will extrapolate to the limits of the nodes you give it. It attempts to do so smoothly. A delaunay based approach will only interpolate within the convex hull of the points. You cannot rationally expect them to yield the same results. Both methods are useful, valuable, and important, though usually on different problems.
Note that gridfit does have several methods for your use. Those who try to build a surface that may involve a great deal of extrapolation as it appears here, may do better with the 'springs' option for the regularizer in gridfit. That option was designed to be less aggressive about extrapolation. The fact is however, extrapolation over long distances is a terribly poor idea in general.
A method that works only on a convex hull cannot extrapolate well. As well, when your data is not fully convex, expect to see problems. Typically, one sees large triangles around the edges of the domain when the data is not convex. Then you should expect to see poor interpolation characteristics in those regions.
What is best is to understand every method one might use, and know when to use one tool or another. A good workman understands all of the tools in their toolbox, and knows when to use each of them to best advantage.
Categories
Find more on Lighting, Transparency, and Shading 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!
