Mercurial > hg > octave-lyh
diff scripts/polynomial/pchip.m @ 11587:c792872f8942
all script files: untabify and strip trailing whitespace
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 20 Jan 2011 17:35:29 -0500 |
parents | 702dbd0c53f5 |
children | 59e2460acae1 |
line wrap: on
line diff
--- a/scripts/polynomial/pchip.m +++ b/scripts/polynomial/pchip.m @@ -37,7 +37,7 @@ ## @code{[@var{s1}, @var{s2}, @dots{}, @var{sk}, @var{n}]} ## @end ifnottex ## The array is then reshaped internally to a matrix where the leading -## dimension is given by +## dimension is given by ## @tex ## $$s_1 s_2 \cdots s_k$$ ## @end tex @@ -48,7 +48,7 @@ ## is exactly the opposite treatment than @code{interp1} and is done ## for compatibility. ## -## Called with a third input argument, @code{pchip} evaluates the +## Called with a third input argument, @code{pchip} evaluates the ## piecewise polynomial at the points @var{xi}. There is an equivalence ## between @code{ppval (pchip (@var{x}, @var{y}), @var{xi})} and ## @code{pchip (@var{x}, @var{y}, @var{xi})}. @@ -105,7 +105,7 @@ d1 = d(:,1:n-1); d2 = d(:,2:n); - ## This is taken from SLATEC. + ## This is taken from SLATEC. h = diag (h); delta = diff (y, 1, 2) / h; @@ -127,9 +127,9 @@ endfunction %!demo -%! x = 0:8; +%! x = 0:8; %! y = [1, 1, 1, 1, 0.5, 0, 0, 0, 0]; -%! xi = 0:0.01:8; +%! xi = 0:0.01:8; %! yspline = spline(x,y,xi); %! ypchip = pchip(x,y,xi); %! title("pchip and spline fit to discontinuous function"); @@ -139,7 +139,7 @@ %! % confirm that pchip agreed better to discontinuous data than spline %!shared x,y -%! x = 0:8; +%! x = 0:8; %! y = [1, 1, 1, 1, 0.5, 0, 0, 0, 0]; %!assert (pchip(x,y,x), y); %!assert (pchip(x,y,x'), y');