Using griddata on an unstructured grid

26 次查看(过去 30 天)
Hello
This is probably a very silly question but I can't really wrap my head around griddata. I've used it previously but it was a lot more straight forward then!
So right now I have one set of coordinates (x,y) which represent and unstructured grid. I also have another set of coordinates with represent the centre of each of those triangles in the unstructured grid. I have a velocity value for each of the points within the triangle. What I need to do is to interpolate the data from the centre of the triangle to the different node points, which would be my first set of coordinates. I've been trying to use griddata but keep getting error messages.
I'm not sure if I've explained myself very well but I've attached my code to this question so hopefully that will be clearer.

采纳的回答

KSSV
KSSV 2016-9-6
编辑:Stephen23 2016-9-6
As your data is unstructured, you can consider this data as scattered data. Why don't you use scatteredInterpolant? I have used this quite lot of times for unstructured grid and it worked perfectly for me.
More on:
  10 个评论
Meghan
Meghan 2016-9-6
You are a life saver! I've been trying to figure this out all day!
Thanks so much :)
Meghan
Meghan 2016-9-7
Steven I wonder if you can help me. That method above does what I want when the v value is 79244x1. Can I use the same method if v is 79244x24x10? I've been fiddling with it this morning and haven't had much luck. I keep getting the error
Error using scatteredInterpolant
Input data point values have invalid dimension. The data must be specified in column-vector format.
I've introduced a z matrix so that the input is
XY3=scatteredInterpolant(uvX,uvY,mesh.uvdepth,u3,'linear');
Not sure if that is correct? Any advice?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interpolation 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by