Interpolation outside the domain - meshgrid and griddata
Afficher commentaires plus anciens
Hello Matlab community,
I need your knowledge on a problem.
I have three vectors, two of them being (x,y) pairs, and the third being T=f(x,y).
I used meshgrid in the following way:
x_grid = linspace(min(x),max(x),1000);
y_grid = linspace(min(y),max(y),1000);
[xq,yq]=meshgrid(x_grid , y_grid );
Now I can plot my data in the following way:
T_interp = griddata(X,Y,T,xq,yq);
figure
contour(xq,yq,T_interp )
I attach an image with the cotour plot, and the domain I need superimposed (grey circles).
As seen in the image, I get an interpolation outside the boundaries of the domain I need.
Is there a way to avoid that?
Many thanks and best regards.
2 commentaires
Maria Angela Agizza
le 15 Mai 2018
Modifié(e) : Walter Roberson
le 15 Mai 2018
KSSV
le 16 Mai 2018
Yes it is very much possible to extract the boundary of the given domain. And using inpolygon is apt. Note that, you have used a loop for that, which in unnecessary and time consuming. Attach your data, so that we can help you further. Mean while, you can have a look on boundary to extract the boundaries of the grid.
Réponses (0)
Catégories
En savoir plus sur Interpolation dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!