'griddatan' much slower than 'scatteredInterpolant'

28 visualizaciones (últimos 30 días)
Pierpaolo Maisano
Pierpaolo Maisano el 7 de Mayo de 2018
Respondida: Neil Guertin el 16 de Mayo de 2018
Hello all,
I have got ~50000 scattered 3-dimensional sample points along with ~50000 sample values, based on which I wish to construct a linear interpolant. When I use 'scatteredInterpolant', it takes about 0.5 seconds to construct the interpolant and another 1 second to evaluate it for ~50000 3-dimensional query points. Doing the exact same thing using 'griddatan' takes a lot longer (I stopped the calculation after ~10mins), which I find very strange.
My problem now is that I would like to include another 2 dimensions in the sample point data (making it 5 in total), however 'scatteredInterpolant' cannot deal with sample point dimensions >3. 'griddatan' is made for that purpose, but given the above experience, I have little doubts that constructing and evaluating the corresponding interpolant will take weeks. Plus, we might explore a set of sample points and values, so I'll need to repeat constructing and evaluating the interpolant a certain number of times, and hence it really needs to be much faster.
Can anyone explain to me why, using the same sample points and values, 'scatteredInterpolant' is so much faster than 'griddatan', and, most importantly, if there is any way to generalise 'scatteredInterpolant' by hand in order for it to be able to deal with higher dimensional sample data?
Many thanks in advance.

Respuestas (1)

Neil Guertin
Neil Guertin el 16 de Mayo de 2018
The 'griddatan' function and 'scatteredInterpolant' object process the data differently, which leads to the difference in performance that you see. Usually 'scatteredInterpolant' is recommended because of its additional features and better performance, however it only supports 2-D or 3-D data.
To increase performance I would recommend decreasing the number of sample points used. How this affects the result would depend on how smooth the data is and which interpolation method you use.
The 'griddedInterpolant' object supports N-D data, so depending on the structure of your data it might work too.

Categorías

Más información sobre Interpolation en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by