Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.fr>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How to find vector value via matrix value?
Date: Mon, 21 Jul 2008 20:50:17 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 38
Message-ID: <g62sq9$m02$1@fred.mathworks.com>
References: <g62lhb$4sn$1@fred.mathworks.com> <g62nns$s4g$1@canopus.cc.umanitoba.ca> <g62q3i$nrm$1@fred.mathworks.com> <g62rre$4f8$1@canopus.cc.umanitoba.ca>
Reply-To: "Bruno Luong" <b.luong@fogale.fr>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1216673417 22530 172.30.248.37 (21 Jul 2008 20:50:17 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 21 Jul 2008 20:50:17 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:480775



roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
message <g62rre$4f8$1@canopus.cc.umanitoba.ca>...

> 
> Hmmm, that does work for 2007a, but it disagrees with
> the documented behaviour:
> 
> >> help interp1
> 
>     YI = INTERP1(X,Y,XI,METHOD,'extrap') uses the
specified method for
>     extrapolation for any elements of XI outside the
interval spanned by X.
>     Alternatively, YI = INTERP1(X,Y,XI,METHOD,EXTRAPVAL)
replaces
>     the values outside of the interval spanned by X with
EXTRAPVAL.
>     NaN and 0 are often used for EXTRAPVAL.  The default
extrapolation
>     behavior with four input arguments is 'extrap' for
'spline' and 'pchip'
>     and EXTRAPVAL = NaN for the other methods.
> 

Actually I do agree with the help.

As I understand, by default, if interp1 is called 4
arguments (no specified extrapolation method), then
- NaN is returned for node that fall outside for 'nearest',
'linear', and 'v5spline'
- real extrapolation for 'spline', 'pchip', 'cubic' (since
'cubic' is special case of 'spline')

If 'extrap' is specified as fifth argument, then real
extrapolation is performed by applying specified method
(same as interpolation method).

Bruno