View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Regular Control Point Interpolation Matrix with Boundary Conditions

5.0 | 1 rating Rate this file 10 Downloads (last 30 days) File Size: 4.73 KB File ID: #26292 Version: 1.8.1
image thumbnail

Regular Control Point Interpolation Matrix with Boundary Conditions


Matt J (view profile)


06 Jan 2010 (Updated )

Creates Toeplitz-like matrices representing interpolation operations with edge conditions.

| Watch this File

File Information

The main file interpMatrix.m in this package creates a sparse Toeplitz-like matrix representing a regularly-spaced interpolation operation between a set of control points. The user can specify the interpolation kernel, the number of control points, the spacing between the control points, and certain boundary conditions governing the behavior at the first and last control point.
The tool has obvious applications to interpolation, curve fitting, and signal reconstruction. More generally, the ability to represent interpolation as a matrix is useful for minimizing cost functions involving interpolation operations. For such functions, the interpolation matrix and its transpose inevitably arise in the gradient.
The file Example1D.m in the package gives an example application of the tool to upsampling/signal reconstruction using cubic B-splines with different possible boundary conditions. The screenshot above shows the output of this example, and illustrates how improved signal reconstruction is obtained using boundary extrapolation by mirroring.
Although the matrix generated by interpMatrix() is for 1D interpolation, it can be generalized to n-dimensional tensorial interpolation using kron(). However, a more efficient alternative to kron() is this tool,
whose usage in conjunction with interpMatrix() is illustrated in the file Example2D.m, a generalization of Example1D.m to two dimensions.
   T=interpMatrix(kernel, origin, numCtrlPoints, CtrlPointSep, extraprule)
      T: sparse output matrix. The columns of T are copies of a common interpolation
         kernel (with adjustments for boundary conditions), but shifted in
         increments of the CtrlPointSep parameter (see below) to different control
         point locations. The result is that if x is a vector of coefficients,
         then T*x is the interpolation of these coefficients on the interval
         enclosed by the control points.
   kernel: vector containing samples of an interpolation function, shifted copies
           of which will be used to create the columns of T. This vector never
           needs to be zero-padded. Zero-padding is derived automatically from
           the other input arguments below.
     origin: Index i such that kernel(i) is located at the first control point.
           It is also possible to specify the origin using the following
           string options:
             'max': origin i will be selected where kernel(i) is maximized.
             'ctr': origin i will be selected as ceil((length(kernel)+1)/2).
   numCtrlPoints: number of control points in the system.
   CtrlPointSep: a stricly positive integer indicating the number of samples between
                 control points.
   extraprule: Initially, the shifted copies of "kernel" form the columns of T. The columns are then modified to satisfy edge conditions indicated by the "extraprules" parameter. Options for this parameter are the strings 'zero', 'mirror','rep', 'circ', or 'allcontrib'. These are explained in the help doc.

MATLAB release MATLAB 7.9 (R2009b)
MATLAB Search Path
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (5)
07 Nov 2016 Matt J

Matt J (view profile)

Hi Kexin,

The Description text above provides a link to KronProd.

Comment only
07 Sep 2016 Kexin Zheng

Bonjour, Matt J

when I run the Example2D.m, there is an error:

Undefined function or variable 'KronProd'.

Error in Example2D (line 41)
BasisFine=KronProd({Basis1DFine}, [1 1]);
Could you help me with that ?

Comment only
28 Apr 2016 Matt J

Matt J (view profile)

I have updated the files, restoring the missing examples.

Comment only
27 Apr 2016 edward

edward (view profile)

Example2D.m seems to be missing...

Comment only
13 Apr 2015 Michal Kvasnicka

Thanks Matt ... nice code (effective, well documented)

07 Jan 2010 1.1

Minor clarifications to summary and description section.

11 Jan 2010 1.2

Small bug fix. The 'allcontrib' option for the "extraprules" input parameter led to extra columns of zeros in output matrix.

14 Jan 2010 1.3

Small edit to Description section

06 Feb 2010 1.4

Removed for-loops from the implementation of interpMatrix.

12 Sep 2010 1.5

Added new options for the "origin" input argument. One can now specify it using a string 'max', which will set the origin automatically to where the kernel is maximum. The string 'ctr' will set it to the center of the kernel profile.

20 Sep 2010 1.6

Edited description only. No new code.

08 Nov 2010 1.7

Small update of Example1D.m and Example2D.m to use the new origin='max' feature. No change to interpMatrix.m

16 Nov 2015 1.8

* Small bug fix. The bug threw error messages when 'circ' end conditions and a small number of control points were used.

28 Apr 2016 1.8.1

Restored missing examples.

Contact us