bugGNU Octave - Bugs: bug #63093, FFT2 produces a result that...

 
 

bug #63093: FFT2 produces a result that differs from MATLAB

Submitter:  None
Submitted:  Fri 23 Sep 2022 12:14:37 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Duplicate Assigned to:  None
Originator Name:  STEPHEN E RANKIN Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 6.4.0
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Fri 23 Sep 2022 12:54:33 PM UTC, comment #1: 

This seems to be identical to bug #63094 (which already has an additional post).

Closing as duplicate.

Markus Mützel <mmuetzel>
Group administrator
Fri 23 Sep 2022 12:14:37 PM UTC, original submission:  

The result of trying to differentiate a Gaussian by FFT fails on Octave running on Ubuntu 22.04, but works on MATLAB with the same code:

    size2 = 101;
    A = 10;
    sigma = 10;
    gauss = zeros(size2);

    for y = 1:size2
        for x = 1:size2
            gauss(y,x)=A*exp(-1/(sigma^2)*((y-size2/2)^2+(x-
            size2/2)^2)); %gaussiana
        end
    end



    hf = fftshift(fft2(gauss));
    [U,V] = meshgrid(-50:50, -50:50);
    hf2 = (exp(1i*2*pi*U/101) - 1).*(exp(1i*2*pi*V/101) - 1).*hf;
    out_freq = real(ifft2(ifftshift(hf2)));
    out_freq = out_freq(1:end-1,1:end-1);
    out_spatial = diff(diff(gauss, 1, 1), 1, 2);
    figure;
    subplot(1,2,1);
    imshow(out_spatial, []);
    title('Derivative from spatial domain');
    subplot(1,2,2);
    imshow(out_freq, []);
    title('Derivative from frequency domain');


Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-09-23 mmuetzel StatusNone Duplicate
        Open/ClosedOpen Closed
        Dependencies- Depends on bugs #63094

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code