90 views (last 30 days)

Hey there,

I've been looking for ages now, but I just don't find a solution that solves my problem. I am pretty sure that it can be solved with some combination of reshaping, ndgrid/mesh, or gridded interpolation but I just don't get it.

I've a data set of hot-wire measurement velocities that have been sequentially recorded on specific locations in the xz-plane with a traverse-system. The problem is that the data is not a full uniform grid, but sparse. Actually, the traversing process was performed in a way to get several locations within a given area, while avoiding hitting a circular obstacle. Additionally the area close to the obstacle was sampled more densely as compared to regions farther away from the obstacle.

As a result I have a matrix with 3 columns and for example 400 rows in the following way:

x z values (3 columns)

x1 z1 value1

x2 z2 value2

x3 z3 value3

. . .

. . .

. . .

But the problem is:

- the data was collected in some wierd order, e.g. the first 6 coordinates (x-component) are [-5; -5; -3; 10; 10; 0.8; ...] and the first 6 coordinates (z-component) are [0.2; 0.2; 5; 3; 2; -1; ...] ...
- the data does not represent a uniform and equally spaced grid: all data (for example) lies within the range [-5 <= x <= 10] and [-2 <= z <= 6], but it is possible that there are 8 z-positions for one x-position, while at another x-position there are only 3 z-positions and at several other x-positions there are no z-positions at all (as within the obstacle region).
- But there is a greatest common grid resolution divisor, e.g. 0.1 so all x and z-coordinates are positive or negative multiples of 0.1. This means it would be possible to generate a huge matrix (xz-plane) that includes all possible locations. I think this could help somehow.

What I need basically: I just want a simple contourf plot of the data within the xz-plane and areas that have not been recorded are either interpolated or better filled with NaNs or Zeros or something like that. Actually, I know the coordinates of the obstacle and might just draw it as overlay later.

Do you know how to get my desired result in a convenient manner?

Opportunities for recent engineering grads.

Apply Today
## 1 Comment

## Direct link to this comment

https://la.mathworks.com/matlabcentral/answers/338393-how-to-prepare-and-plot-unequally-spaced-irregular-data-to-a-contour-plot-or-similar#comment_450730

⋮## Direct link to this comment

https://la.mathworks.com/matlabcentral/answers/338393-how-to-prepare-and-plot-unequally-spaced-irregular-data-to-a-contour-plot-or-similar#comment_450730

Sign in to comment.