![]() ![]() ![]() Also uses a small trick to rearrange the linear operation, such that yi = y1 + s*(xi-x1), where s = (y2-y1)/(x2-x1), now becomes yi = y1 + t*(y2-y1), where t = (xi-x1)/(x2-x1), which reduces the need for replicating a couple of matrices and the right hand division operation for 't' is simpler than it was for 's' because it takes place only in one dimension (both 'x' and 'xi' are column vectors).Īcknowledgements: Nils Oberg, Blake Landry, Marcelo H. Uses the function 'histc' to get the 'xi_pos' vector. This function uses the approach given by Loren Shure (The MathWorks) in ![]() 'y' must be a column vector or matrix with m=length(x) rows.Īs with 'interp1q', if 'y' is a matrix, then the interpolation is performed for each column of 'y', in which case 'yi' is p=length(xi) by n=size(y,2).Īs with 'interp1q', this function returns NaN for any values of 'xi' that lie outside the coordinates in 'x', and when 'xi' is NaN. 'x' must be a monotonically increasing column vector. To work properly user has to be aware of the following: It runs at least 3x faster than 'interp1q' and 8x faster than 'interp1', and more than 10x faster as m=length(x) increases (see attached performance graph).Īs with 'interp1q', this function does no input checking. It has same functionality as built-in MATLAB function 'interp1q' (see MATLAB help for details). 'yi' is matrix, corresponding to 'xi'. 'x' is column vector, monotonically increasing. Performs 1D linear interpolation of 'xi' points using 'x' and 'y', resulting in 'yi', following the formula yi = y1 + (y2-y1)/(x2-x1)*(xi-x1). Quicker 1D linear interpolation: 'interp1qr' ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |