ABSTRACT

Both R and MATLAB platforms contain facilities for performing standard numeric computations such as root-finding, function optimization, numerical integration or quadrature, numerically solving differential equations, and so on. One of the biggest differences between R and MATLAB when using root-finding is the default tolerance. To change the tolerance in MATLAB to match the default behavior of R, use optimset to construct an optimization options set. Both R and MATLAB platforms include routines to perform numerical integration, or quadrature, using adaptive step sizes to achieve a desired level of accuracy. MATLAB also includes a function trapz which performs trapezoidal numerical integration. Routines exist in both platforms to aid in constructing a function which implements piecewise linear interpolation based on a set of points. To fit a polynomial with zero intercept, there is no simple way to use polyfit for the task.