[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #45125] griddata matlab incompatibility
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #45125] griddata matlab incompatibility |
Date: |
Mon, 18 May 2015 20:41:32 +0000 |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0 |
Follow-up Comment #1, bug #45125 (project octave):
Could you try the following in Matlab?
x=rand(10,1);
y=rand(10,1);
z=rand(10,1);
xi=rand(5,1);
yi=rand(5,1);
[xi2, yi2, zi2] = griddata(x,y,z,xi,yi)
What I find in Octave is that zi2 is a 1-D vector, not a 2-D matrix. When you
try to call surf with
surf (xi2, yi2, zi2)
you get an error because zi2 needs to be a 2-D matrix (surface).
>From the documentation, it seems that if xi and yi are vectors then the output
should also be a vector of zi at the requested points. In that case, perhaps
plot3() should be called instead of mesh() to plot individual points.
The code in griddata.m is
if (nargout == 3)
rx = xi;
ry = yi;
rz = zi;
elseif (nargout == 1)
rx = zi;
elseif (nargout == 0)
mesh (xi, yi, zi);
endif
which could be modified to
elseif (nargout == 0)
if (isvector (zi))
plot3 (xi, yi, zi);
else
mesh (xi, yi, zi);
endif
endif
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?45125>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/