Mercurial > hg > octave-lyh
changeset 14492:7ce925166af6
Fix inconsistent orientation of output matrix for interp1.
* interp1.m: Fix inconsistent orientation of output matrix. Properly include
the extrapolaed values.
author | Olaf Till <i7tiol@t-online.de> |
---|---|
date | Thu, 22 Mar 2012 21:00:52 -0400 |
parents | 5bd9e47e9277 |
children | 351ca094580b |
files | scripts/general/interp1.m |
diffstat | 1 files changed, 9 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/general/interp1.m +++ b/scripts/general/interp1.m @@ -248,9 +248,13 @@ if (ispp) y = shiftdim (reshape (y, szy), 1); yi = pchip (x, y); + yi.orient = "first"; else y = shiftdim (y, 1); yi = pchip (x, y, reshape (xi, szx)); + if (! isvector (y)) + yi = shiftdim (yi, 1); + endif endif case {"spline", "*spline"} if (nx == 2 || starmethod) @@ -260,9 +264,13 @@ if (ispp) y = shiftdim (reshape (y, szy), 1); yi = spline (x, y); + yi.orient = "first"; else y = shiftdim (y, 1); yi = spline (x, y, reshape (xi, szx)); + if (! isvector (y)) + yi = shiftdim (yi, 1); + endif endif otherwise error ("interp1: invalid method '%s'", method); @@ -280,20 +288,11 @@ yi(outliers) = extrap; yi = reshape (yi, szx); elseif (!isvector (yi)) - if (strcmp (method, "pchip") || strcmp (method, "*pchip") - ||strcmp (method, "cubic") || strcmp (method, "*cubic") - ||strcmp (method, "spline") || strcmp (method, "*spline")) - yi(:, outliers) = extrap; - yi = shiftdim(yi, 1); - else - yi(outliers, :) = extrap; - endif + yi(outliers, :) = extrap; else yi(outliers.') = extrap; endif endif - else - yi.orient = "first"; endif endfunction