help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: INTERP2 / GRIDDATA : problems using those functions


From: Pierre Baldensperger
Subject: Re: INTERP2 / GRIDDATA : problems using those functions
Date: Tue, 22 Nov 2005 23:39:23 +0100
User-agent: Mozilla Thunderbird 1.0.7 (Windows/20050923)

Hello,

Thank you very much, Gottfried! This indeed solves the "griddata" problem and the result looks OK. Never encountered this transposition problem before. It's
something worth remembering!

Concerning the "interp2" problem, I don't think it would make sense to
transpose any of the arguments. However, I had a quick look at the source of
"interp2.m" and it looks to me like the algorithm assumes XI and YI are in
"meshgrid" format, which is not the case in my example, and which is also not
clearly specified in the routine's help messages. In my opinion, requiring
"meshgridded" XI and YI would seriously restrict the field of application of
that function, so it is likely to be a mistake...

I'm not sure I have fully understood how it works, but the following calls to the "lookup" function only consider the first line (resp. first column) of XI
(resp. YI), as if the other lines (resp. columns) were identical, which may
not always be the case (unless they are in "meshgrid" format).

xidx = lookup(X(1, 2:end-1), XI(1,:))' + 1;
yidx = lookup(Y(2:end-1, 1), YI(:,1)) + 1;

Same strong suspicion for the subsequent lines (including "nearest" method).
Anybody out there has an idea how to fix it? Do you know how I can contact the
author / maintainer of that routine, so I can submit this problem to him
directly?

Thanks again,
-Pierre.



Gottfried Necker wrote:

Hello,

I don't think your octave installation is corrupt. I can see the same problems. For the griddata case I would suggest to transpose the first 3 arguments to griddata, i.e.:
posx_1d=reshape(posx,size(posx,1)*size(posx,2),1);
posy_1d=reshape(posy,size(posy,1)*size(posy,2),1);
funcz_1d=reshape(funcz,size(funcz,1)*size(funcz,2),1);

Using these lines, the problem with cross goes away. But I don't know, whether it gives the correct result. If I remember correctly octave sometimes returns/expects a row vector where matlab returns a column vector and/or vice versa. This might also cause the problems with the interp2 case, but I don't know.

Gottfried






-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]