File Exchange

image thumbnail


version (159 KB) by Alberto Comin
adaptive function evaluation

1 Download

Updated 25 Jan 2017

View License

'adaptive.m' allows to efficiently sample a function using a reduced number of points. It works by iteratively adding new points where needed. It is especially useful for functions which are computationally intensive (e.g. involve solving a differential equation).
% using default options
[xi, yi] = adaptive(@(x) sin(x)*sin(2*x), [-20,20]);
% explicitly providing initial array an refinement option
f = @(x) exp(-x.^2/4).*sin(3*x);
[xi,yi] = adaptive(f, [ -5:5], 'minAngle',0.8*pi);

Cite As

Alberto Comin (2019). adaptive (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (2)

Is there a multi-dimensional version of this?


If there going to be a 3D version?


fixed default settings

minor fixes

1) new default when called without optional arguments
2) it is now possible to provide a domain range instead of an initial array
3) new key-word argument 'nPoints'
4) now can return domain points and function values as two separate arrays.

MATLAB Release Compatibility
Created with R2016b
Compatible with any release
Platform Compatibility
Windows macOS Linux