Smooth out griddata results

1 view (last 30 days)
Pedro Torres
Pedro Torres on 21 Nov 2017
Commented: Naomi Krauzig on 19 Mar 2019
I have a set of velocity values and coordinates exported from ANSYS Fluent (in vector form), and want to interpolate the into a grid. I have done this with a couple of other experiments, with no issues, but this time this is producing confusing results, and the contour plot doesn't give out smooth results.
A = dlmread(fileName,'', 1, 1);
xa=A(:,1);
ya=A(:,2);
u=A(:,3);
v=A(:,4);
dx = 6.25E-5;
[x,y]=meshgrid(0:dx:0.05, 0:dx:0.01);
vx = griddata(xa,ya,u,x,y);
vy = griddata(xa,ya,v,x,y);
This produces a contourf(vx) like so:
What can I do to smooth out this interpolation?
  1 Comment
Naomi Krauzig
Naomi Krauzig on 19 Mar 2019
Hello Pedro,
you can try to change the method during the gridding:
vx = griddata(xa,ya,u,x,y,'cubic');
vy = griddata(xa,ya,v,x,y,'cubic');
the interpolation method can be'linear', 'nearest', 'natural', 'cubic', or 'v4'.
The default method is 'linear' and the 'cubic' one usually smooths the results a bit but you should take a look and pick one that best suits your needs.
Hope that helps a bit,
Naomi

Sign in to comment.

Answers (0)

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!