I have some data in a form data = {{x,y,f[x,y]},...}, where f[x,y] takes only positive values. When I try to interpolate it, Interpolation[data], interpolated function has negative values at particular points, like on the plot. Is there some way to interpolate the data with forced condition to take only positive values (not involved InterpolationOrder->0)?

enter image description here

  • 1
    $\begingroup$ You could try using a monotonic interpolation method (e.g. Steffen) to compute the gradients in one direction. $\endgroup$ – J. M.'s ennui Sep 24 '18 at 19:07
  • 1
    $\begingroup$ You could take the log of the data, interpolate and then exponentiate. This is guaranteed to be positive, but you will have to judge the fit for yourself. $\endgroup$ – mikado Sep 24 '18 at 19:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.