How do I fit a surface to this data properly?
2 views (last 30 days)
I have a set of datapoints (x,y,z) to which I want to fit a surface. I dont have a mathematical expression for the surface, so I tried to use the linear interpolation as in:
PTSGRID = 256;
xs = min(x):(max(x)-min(x))/(PTSGRID-1):max(x);
ys = min(y):(max(y)-min(y))/(PTSGRID-1):max(y);
[xq, yq] = meshgrid(xs,ys);
zq = griddata(x,y,z,xq,yq,'linear');
However the fitted surface takes very strange values where there is no data defined, very different from what I would visually expect. Take a look for example at this figure, and the zone I circled:
How can I fit in a better way to avoid this behavior?