Mercurial > hg > octave-avbm
changeset 9677:8cf522ce9c4d
fix griddata with vectors
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Thu, 01 Oct 2009 08:34:13 +0200 |
parents | e40835382b68 |
children | c929f09457b7 |
files | scripts/ChangeLog scripts/geometry/griddata.m |
diffstat | 2 files changed, 8 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2009-10-01 Jaroslav Hajek <highegg@gmail.com> + + * geometry/griddata.m: Fix handling vector xi, yi. + 2009-09-30 Jaroslav Hajek <highegg@gmail.com> * general/arrayfun.m: Simplify.
--- a/scripts/geometry/griddata.m +++ b/scripts/geometry/griddata.m @@ -51,13 +51,12 @@ error ("griddata: x, y, and z must be vectors of same length"); endif - ## Meshgrid xi and yi if they are vectors unless they - ## are vectors of the same length. - if (isvector (xi) && isvector (yi) && numel (xi) != numel (yi)) + ## Meshgrid xi and yi if they are a row and column vector. + if (rows (xi) == 1 && columns (yi) == 1) [xi, yi] = meshgrid (xi, yi); endif - if (any (size (xi) != size (yi))) + if (! size_equal (xi, yi)) error ("griddata: xi and yi must be vectors or matrices of same size"); endif @@ -114,7 +113,7 @@ D = -(N(:,1) .* x1 + N(:,2) .* y1 + N(:,3) .* z1); ## Calculate zi by solving plane equation for xi, yi. - zi(valid) = -(N(:,1).*xi(valid) + N(:,2).*yi(valid) + D) ./ N(:,3); + zi(valid) = -(N(:,1).*xi(:)(valid) + N(:,2).*yi(:)(valid) + D) ./ N(:,3); else error ("griddata: unknown interpolation method");