No BSD License  

Highlights from
Fast Linear Interpolation

4.33333

4.3 | 3 ratings Rate this file 20 Downloads (last 30 days) File Size: 3.41 KB File ID: #8627

Fast Linear Interpolation

by Umberto Picchini

 

04 Oct 2005 (Updated 20 Apr 2006)

Performs linear interpolation with a speed acceleration of (up to) 4x.

| Watch this File

File Information
Description

F = lininterp1f(X,Y,XI,Ydefault) returns the value of the 1-D function Y at the points XI using linear interpolation. Length(F)=length(XI). The vector X specifies the coordinates of the underlying interval. Ydefault is returned for values of XI outside the coordinates in X.
For lininterp1f to work properly:
X must be a monotonically increasing array;
Y must be an array with length(Y)=length(X);
XI must be an array.
Ydefault must be a scalar value or an empty matrix [].

Example:
>> x = [1:1:1000];
>> y =log(sqrt(x+1.001)-1.001);
>> xv =[5:.001:100];
>> yinterp =lininterp1f(x,y,xv,[]);

Warning: not much in the way of error checking, since this slows things down, so pay attention to the argument passed to the function!!!

Installation (Windows users):
------------------------------

Simply copy the lininterp1f.dll file in a directory recognizable by MATLAB. You won't need lininterp1f.c to perform computations, but it is useful if you want to read the user instructions or to customize your code. If you modify lininterp1f.c then you must run the following command

mex lininterp1f.c

in order to obtain the new dll file.

Installation (other OS users):
-------------------------------

You have to compile lininterp1f.c with your favourite C compiler (write "mex -setup" at the MATLAB prompt), then write

mex lininterp1f.c

in order to obtain the corresponding mex-file (see the table below)

        OS ---> Extension
      ------------------------------
        sol2, SunOS 5.x ---> .mexsol
        hpux ---> .mexhpux
        hp700 ---> .mexhp7
        ibm_rs ---> .mexrs6
        sgi ---> .mexsg
        alpha ---> .mexaxp
        glnx86 ---> .mexglx

PLEASE RATE MY SUBMISSION!

Acknowledgements
This submission has inspired the following:
ScaleTime
MATLAB release MATLAB 6.5 (R13)
Other requirements Non-Windows users need a C-compiler; use the "mex -setup" command to search for the available compiler(s).
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
09 Feb 2006 Jay Leno  
04 Jul 2007 Felipe Nievinski  
04 Aug 2010 Erik

Great job! I achieved a speed up of 70x compared to interp1

Please login to add a comment or rating.
Updates
11 Oct 2005

User instructions updated.

20 Oct 2005

no modifications: I just added my request to give a rate to this submission.

27 Oct 2005

Title changed

14 Nov 2005

Now the inputs can be either row or column arrays. The output is a row array.

15 Nov 2005

no significant changes

27 Dec 2005

this version has been created with the LCC compiler (instead of Visual Studio 6); the installation steps description has been expanded.

28 Dec 2005

Mistakes corrected in the Description section; Requirements added

22 Feb 2006

no significative changes

20 Apr 2006

No changes

Tag Activity for this File
Tag Applied By Date/Time
approximation Umberto Picchini 22 Oct 2008 08:01:39
interpolation Umberto Picchini 22 Oct 2008 08:01:39
linear Umberto Picchini 22 Oct 2008 08:01:39
quick Umberto Picchini 22 Oct 2008 08:01:39
fast Umberto Picchini 22 Oct 2008 08:01:39
mex Umberto Picchini 22 Oct 2008 08:01:39
interpolation vega valentine 13 Jun 2011 05:53:18

Contact us at files@mathworks.com