Using gridfit to compute data for a hill chart

9 views (last 30 days)
Hello everyone,
smoothing a surface with the gridfit function found on FEX here seemed to me like a good way to "clean" up data in order to generate a clear hill chart. However gridfit extrapolates the data to the grid boundries, so the generated contour plot doesnt really look like its supposed to.
Is there a way to still use the smoothing of gridfit without extrapolating to the grid boundries? For example, this first image shows the mesh generated using Matlabs own meshgrid and griddata functions.
The next image shows the result of using gridfit with the exact same inputs.
As you can see, the 2nd mesh is not useable for a contour plot. So is there a way to use gridfit without extrapolating to the edges of the grid nodes, only smoothing the existing x,y,z values? I'm still somewhat new to Matlab and maybe I've just used the inputs/options in a wrong way?
Thanks for your help!

Accepted Answer

John D'Errico
John D'Errico on 9 Aug 2017
Edited: John D'Errico on 9 Aug 2017
Gridfit is designed to extrapolate, and to do so as smoothly as possible. That is how it is written, and you will not change it. There are no settings you can change in this matter. Sorry.
gridfit works on a rectangular lattice in the (x,y) plane. With a bit of programming expertise, you could triangulate that lattice, then carefully deal with those triangles that cross the convex hull. The result will be a new triangulation that lies entirely inside the convex hull of the data. It would take some work on your part though, and an understanding of how triangulations can be manipulated.
I can think of two other viable schemes to solve the problem. But if you insist on using a tool that will smooth the surface within the convex hull, then it will take some effort on your part.
  1 Comment
Ingo Rück
Ingo Rück on 15 Aug 2017
Thats too bad, but it was worth a shot. I'm still fairly new to matlab, so trying to modify a big function like this is probably beyond my current skill level. Thanks for the advice!

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!