5.0

5.0 | 3 ratings Rate this file 24 downloads (last 30 days) File Size: 3.58 KB File ID: #13183

tinterp - an alternative to griddata

by Darren Engwirda

 

30 Nov 2006 (Updated 30 Nov 2006)

No BSD License  

Linear and quadratic interpolation for scattered data

Download Now | Watch this File

File Information
Description

Provides linear and quadratic interpolation methods for functions defined on scattered 2D datasets.

The quadratic method in tinterp seems to be superior when compared to the cubic method in gridata.

Type "help tinterp" & "help tester"

MATLAB release MATLAB 6.5 (R13)
Zip File Content  
Other Files tinterp/tester.m,
tinterp/tinterp.m
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (4)
01 Dec 2006 John D'Errico

An alternative to griddata - similar in speed when you add in the time for the triangulation.

The advantage of this code is if you already have a triangulation, then this saves the time to regenerate it. It also allows you to use a custom, non-delaunay triangulation - not an option at all for griddata.

A disadvantage of this code is it forces you to do the triangulation to call it. Its an unnecessary step for many people, so I'd probably be tempted to allow the user to not supply the triangulation, so if t is empty it could just call delaunay.

This code offers properties similar to griddata. It will not extrapolate beyond the convex hull of the data, Extrapolation is risky business of course, so thats not necessarily bad.

Good help, examples. The quadratic interpolant is an interesting idea.

07 Feb 2008 Craig M.

I make hundreds of 2D interpolations for a given triangulation. This function is exactly what I need. Thx.

14 May 2009 Jo Williams  
07 Sep 2009 carlos lopez

I would like to have more information of the theory behind this. What it means that it is "quadratic"? Should it be exact for 2nd. degree functions? I tried this
X=[1:10 1:10];Y=[zeros(1,10) ones(1,10)];%Data points
f=100*(X').^2; %data points
tri=delaunay(X,Y);%Triangulation
triplot(tri,X,Y) %to interpret the case
x=linspace(0,11,300);y=repmat(0.5,1,300);
fC=tinterp([X' Y'],tri,f,x,y,'quadratic');
plot(diff(fC));%should be linear if the interpolant is exact for 2nd degree

Apparently from this example the interpolant is C0 (i.e. continuous but not differentiable), but it is a little bit misleading what is meant by "quadratic".

I tried to contact the author before posting, but apparently changed addres. Thank you anyway for his contribution.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
approximation Darren Engwirda 22 Oct 2008 08:50:51
interpolation Darren Engwirda 22 Oct 2008 08:50:51
scattered interpolation Darren Engwirda 22 Oct 2008 08:50:51
linear Darren Engwirda 22 Oct 2008 08:50:51
quadratic Darren Engwirda 22 Oct 2008 08:50:51
2d Darren Engwirda 22 Oct 2008 08:50:51
data sets Darren Engwirda 22 Oct 2008 08:50:51
tinterp Darren Engwirda 22 Oct 2008 08:50:51
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com