octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #65134] griddata function incompatibility with


From: Arnaud Delorme
Subject: [Octave-bug-tracker] [bug #65134] griddata function incompatibility with MATLAB
Date: Sun, 7 Jan 2024 14:31:42 -0500 (EST)

URL:
  <https://savannah.gnu.org/bugs/?65134>

                 Summary: griddata function incompatibility with MATLAB
                   Group: GNU Octave
               Submitter: arnodelorme
               Submitted: Sun 07 Jan 2024 07:31:41 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: Arno
        Originator Email: 
             Open/Closed: Open
                 Release: 8.4.0
         Discussion Lock: Any
        Operating System: Mac OS
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Sun 07 Jan 2024 07:31:41 PM UTC By: Arnaud Delorme <arnodelorme>
Tested with MATLAB 2023b and Octave 8.4

Using this code


xi = linspace(1,10,100);
yi = linspace(1,10,100); 
[Xi,Yi,Zi] = griddata(1:10,1:10,double(rand(10,10)),yi',xi,'v4'); 


The size of Xi is 100x100 on MATLAB but it is 100x1 on Octave.
On Octave to achieve the same result, one must use.


xi = linspace(1,10,100);
yi = linspace(1,10,100);
[xi,yi] = meshgrid(xi, yi);
[Xi,Yi,Zi] = griddata(1:10,1:10,double(rand(10,10)),yi,xi,'v4'); 


In the first call, because yi is transposed, the griddata function
automatically calls the meshrid function. In Octave, to do the trick, it might
be possible to add a check at the beginning of the griddata function such as:


if all(size(xi) == size(yi)') && any(size(xi) == 1)
    [xi,yi] = meshgrid(xi, yi);
end


Right now, the Octave griddata performs a 1-D interpolation while MATLAB
performs of a 2-D interpolation.







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?65134>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/




reply via email to

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