Extrapolation with minimum variation
Show older comments
Hello everyone,
I have a function of two variables that I don't know and I want to try to guess. For this I have a small number of samples and their value in the function. To apply my method, I must calculate the gradient of the function (in this case of the interpolation of my function) to see where I find the maximum differences in the gradient to sample more in those areas. If I apply an interpolation (linear for example) to the data I have, I cannot calculate the gradient of the output because I get NaN values (the interpolation only works for points inside the convex hull and the domain of the function is larger). I have tried extrapolating using scatteredInterpolant, inpaint_nans and inpaintn but the values I get in some extrapolated areas differ quite a lot so the gradient there is very high.
I need a method where the extrapolation hardly varies so that the gradient is focused on the points inside the convex area. What is the best way to do this in Matlab? I can't find any other function that comes close to what I want.
I leave you some screenshots so that you can understand what is happening to me:

As can be seen, when extrapolating, very different values are obtained at the edges (the original function is not like that).

So when computing the gradient, the areas with the most variation are at the edges. I need to calculate the variation inside the points I already have.
Any suggestions are welcome. Thank you very much in advance!
1 Comment
Mathieu NOE
on 25 May 2023
it would be nice to share your code and data
Accepted Answer
More 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!